-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implicit accessor function should return struct members, not struct
If the acessor function returns a single struct, then the members should be returned. If any of those members are structs, then those members will remain structs. contract C { struct S { int a; bool b; } S public s; function foo() public { (int a, bool b) = this.s(); } } Also, the accesor function should be declared `external` and therefore not accessible as an internal function call. Signed-off-by: Sean Young <sean@mess.org>
- Loading branch information
Showing
6 changed files
with
206 additions
and
23 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
10 changes: 10 additions & 0 deletions
10
tests/contract_testcases/solana/accessor/accessor_is_external.sol
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,10 @@ | ||
contract C { | ||
int constant public c = 102; | ||
|
||
function f() public { | ||
int x = c(); | ||
} | ||
} | ||
// ---- Expect: diagnostics ---- | ||
// error: 5:11-14: functions declared external cannot be called via an internal function call | ||
// note 2:22-23: declaration of function 'c' |
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