-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AST validate that a contract does not have a function with contract n…
…ame (#117) * AST validate that a contract does not have a function with contract name * Update test * Address feedback * Change tests * Update crates/sema/src/ast_passes.rs Co-authored-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com> * Update crates/sema/src/ast_passes.rs Co-authored-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com> * Add changes --------- Co-authored-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com>
- Loading branch information
Showing
3 changed files
with
41 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
contract C { | ||
function C() public {} //~ ERROR: functions are not allowed to have the same name as the contract | ||
|
||
function c() public {} | ||
} |
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 @@ | ||
error: functions are not allowed to have the same name as the contract | ||
--> ROOT/tests/ui/parser/contract_function_shared_name.sol:LL:CC | ||
| | ||
LL | function C() public {} | ||
| ^ | ||
| | ||
= note: if you intend this to be a constructor, use `constructor(...) { ... }` to define it | ||
|
||
error: aborting due to 1 previous error | ||
|