solang
solang copied to clipboard
Unwrapping a user-defined type causes compilation crash.
Version: v0.3.3: Atlantis
type MyUInt8 is uint8;
contract C {
function j(MyUInt8 a) external returns (uint) {
return MyUInt8.unwrap(a);
}
}
solang compile --target solana test.sol
thread 'main' panicked at 'assertion failed: `(left == right)`
left: `1`,
right: `32`', src/emit/expression.rs:1933:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Unwrapping a address type also has similar problem.
contract C {
type T is address;
struct Nested {
uint y;
}
struct S {
mapping(uint => T) a;
Nested n;
uint256 nonExistentField;
}
mapping (T => S) m;
function set(address _a) external {
m[T.wrap(_a)].a[0] = T.wrap(_a);
// m[T.wrap(_a)].n = Nested(0);
}
}
thread 'main' panicked at 'Found ArrayValue(ArrayValue { name: "", address: 0x60c237e8c3a8, is_const: false, is_const_array: false, is_const_data_array: false, is_null: false, llvm_value: "[32 x i8] %1", llvm_type: ArrayType { array_type: Type { address: 0x60c237d56610, llvm_type: "[32 x i8]" } } }) but expected the IntValue variant', /github/home/.cargo/registry/src/index.crates.io-6f17d22bba15001f/inkwell-0.2.0/src/values/enums.rs:286:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace