0.8.0_Plato_v4.2
TRON Solidity compiler 0.8.0 is fully compatible with Ethereum Solidity 0.8.0.
Breaking Changes
- Code Generator: All arithmetic is checked by default. These checks can be disabled using
unchecked { ... }
. - Code Generator: Cause a panic if a byte array in storage is accessed whose length is encoded incorrectly.
- Code Generator: Use revert with error signature Panic(uint256) and error codes instead of invalid opcode on failing assertions.
- General: Enable ABI coder v2 by default.
- General: Remove global functions
log0
,log1
,log2
,log3
andlog4
. - Parser: Exponentiation is right associative.
a**b**c
is parsed asa**(b**c)
. - Type Checker: Function call options can only be given once.
- Type System: Declarations with the name
this
,super
and_
are disallowed, with the exception of public functions and events. - Type System: Disallow
msg.data
inreceive()
function. - Type System: Disallow
type(super)
. - Type System: Disallow enums with more than 256 members.
- Type System: Disallow explicit conversions from negative literals and literals larger than
type(uint160).max
toaddress
type. - Type System: Disallow the
byte
type. It was an alias tobytes1
. - Type System: Explicit conversion to
address
type always returns a non-payableaddress
type. In particular,address(u)
,address(b)
,address(c)
andaddress(this)
have the type address instead of address payable (Hereu
,b
, andc
are arbitrary variables of typeuint160
,bytes20
and contract type respectively.) - Type System: Explicit conversions between two types are disallowed if it changes more than one of sign, width or kind at the same time.
- Type System: Explicit conversions from literals to enums are only allowed if the value fits in the enum.
- Type System: Explicit conversions from literals to integer type is as strict as implicit conversions.
Type System: Introduceaddress(...).code
to retrieve the code asbytes memory
. The size can be obtained viaaddress(...).code.length
, but it will currently always include copying the code. - Type System: Introduce
block.chainid
for retrieving the current chain id. - Type System: Support
address(...).codehash
to retrieve the codehash of an account. - Type System: The global variables
tx.origin
andmsg.sender
have type address instead ofaddress payable
. - Type System: Unary negation can only be used on signed integers, not on unsigned integers.
- View Pure Checker: Mark
chainid
as view.
New Features
- Inheritance: Allow overrides to have stricter state mutability:
view
can overridenonpayable
andpure
can overrideview
. - Parser: Deprecate visibility for constructors.
- State mutability: Do not issue recommendation for stricter mutability for virtual functions but do issue it for functions that override.
Language Feature
- Super constructors can now be called using the member notation e.g.
M.C(123)
.
Bugfix
- Type Checker: Perform proper truncating integer arithmetic when using constants in array length expressions.