Open
Description
Describe the issue:
The IR generated for a selector access assigns a fresh reference variable to the selector's integer value. This doesn't seem right, because the point of reference variables is that we should be able to dereference them, and we can't dereference a selector in isolation. Additionally, the typical semantics of REF_n := v
is that the reference variable on the left-hand-side is dereferenced to location l
and the value of rvalue v
is stored in location l
; this doesn't work for a fresh reference variable because it doesn't store any location.
This generated IR should probably be an assignment to a temp variable instead of a reference variable.
Code example to reproduce the issue:
abstract contract Interface {
function test() virtual external ;
}
contract Test {
function test() external view returns (bytes4) {
return Interface.test.selector;
}
}
Version:
0.9.3
Relevant log output:
IR Generated from example:
Contract Test
Function Test.test() (*)
Expression: Interface.test.selector
IRs:
REF_1 (->None) := 4171824493(uint256)
RETURN REF_1