Skip to content

Conversation

@marcvernet31
Copy link

As defined in this issue #216, built in symbols this, super and _ give an error where shadowed as in the example code here:

contract C {
	event this();
	event super();
	event _();
}

This behaviour differs from solc, where this situation only gives a warning on the shadowing (https://github.com/argotorg/solidity/blob/develop/test/libsolidity/syntaxTests/events/illegal_names_exception.sol)

Modified conflicting_declaration to explicitly allow events to shadow builtins, so that it emits a warning instead of error. Added a test case in test/ui/resolve

@DaniPopes DaniPopes force-pushed the fix/builtin-shadowing-check branch from 1e4781b to f721360 Compare December 13, 2025 04:20
@DaniPopes
Copy link
Member

Thanks but this is not the right fix. the problem is that this and super are declared in the same scope as user-defined stuff like events. in our implementation this means the user-defined this will conflict with the existing builtin, which throws a hard error. what we would need to do is somehow either introduce a separate scope in between the builtins and user code, or another way to special case this behavior which i havent looked into

@onbjerg onbjerg changed the title Fix/builtin shadowing check fix(sema): builtin shadowing check Dec 15, 2025
@onbjerg onbjerg added C-bug Category: this is a bug A-sema Area: semantic analysis labels Dec 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-sema Area: semantic analysis C-bug Category: this is a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants