forked from hyperledger-solang/solang
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow using {func} for type to use library functions
Fixes hyperledger-solang#1525 Signed-off-by: Sean Young <sean@mess.org>
- Loading branch information
Showing
5 changed files
with
60 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
contract C { | ||
function foo(int256 a) internal pure returns (int256) { | ||
return a; | ||
} | ||
} | ||
|
||
library L { | ||
function bar(int256 a) internal pure returns (int256) { | ||
return a; | ||
} | ||
} | ||
|
||
library Lib { | ||
function baz(int256 a, bool b) internal pure returns (int256) { | ||
if (b) { | ||
return 1; | ||
} else { | ||
return a; | ||
} | ||
} | ||
using {L.bar, baz} for int256; | ||
} | ||
|
||
library Lib2 { | ||
using {L.foo.bar, C.foo} for int256; | ||
} | ||
|
||
// ---- Expect: diagnostics ---- | ||
// error: 25:15-18: 'foo' not found | ||
// error: 25:20-25: 'C.foo' is not a library function | ||
// note 2:2-55: definition of C.foo |