You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enum values can be implicitly assigned & converted to state variables if named in the same way as the Enum entry.
// SPDX-License-Identifier: MITpragma solidity0.8.25;
contractEnum {
enum SomeEnum { yolo }
// Only works if I call the variable the same as the `Enum` value.addressprivate yolo = yolo;
function enumTest() externalviewreturns (address) {
return yolo;
}
}
I don't think this should compile. You can test it with other types, and it will work in the same way.
Environment
Compiler version: 0.8.25
Target EVM version (as per compiler settings): shangai
Framework/IDE (e.g. Truffle or Remix): chisel or remix
Description
UPDATE: The issue is not about
Enum
but self defining of state variables:The above compiles.
[OLD VERSION]
Enum
values can be implicitly assigned & converted to state variables if named in the same way as theEnum
entry.I don't think this should compile. You can test it with other types, and it will work in the same way.
Environment
0.8.25
shangai
chisel
orremix
Linux
The text was updated successfully, but these errors were encountered: