Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow using {func} for type to use library functions #1528

Merged
merged 4 commits into from
Sep 21, 2023

Conversation

seanyoung
Copy link
Contributor

Fixes #1525

@seanyoung seanyoung marked this pull request as ready for review September 14, 2023 15:32
tests/solana_tests/using.rs Outdated Show resolved Hide resolved
tests/solana_tests/using.rs Outdated Show resolved Hide resolved
@@ -74,7 +74,7 @@ fn using() {
let mut runtime = build_solidity(
r##"
contract test {
using ints for uint32;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This potentially reduces test coverage, or is it tested in another place anyways?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already tested above (line 50 to 70)

@@ -376,7 +377,7 @@ impl Namespace {
.map(|(id, namespace)| (id, namespace.iter().collect()))
.unwrap();

let s = self.resolve_namespace(namespace, file_no, None, id, diagnostics)?;
let s = self.resolve_namespace(namespace, file_no, contract_no, id, diagnostics)?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not to be pedantic, but just s is a bad variable name

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not to be pedantic, but just s is a bad variable name

I agree

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed to symbol

@@ -376,7 +377,7 @@ impl Namespace {
.map(|(id, namespace)| (id, namespace.iter().collect()))
.unwrap();

let s = self.resolve_namespace(namespace, file_no, None, id, diagnostics)?;
let s = self.resolve_namespace(namespace, file_no, contract_no, id, diagnostics)?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not to be pedantic, but just s is a bad variable name

I agree

Comment on lines +273 to +281
if dummy
.cast(
&loc,
&func.params[0].ty,
true,
ns,
&mut Diagnostics::default(),
)
.is_err()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any test in which we are casting the first argument for the library call?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The polkadot test does this

Copy link
Contributor

@xermicus xermicus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Sean Young <sean@mess.org>
@seanyoung seanyoung merged commit a74ab4d into hyperledger-solang:main Sep 21, 2023
15 of 16 checks passed
@seanyoung seanyoung deleted the using branch September 21, 2023 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error with Library's using {f} for ...
3 participants