Open Leminkay opened 2 months ago
as a note, the root of this issue is that _BytestringT.compare_type
is a mutating function. there have been a couple attempts to fix this (most recently, https://github.com/vyperlang/vyper/pull/3379 and https://github.com/vyperlang/vyper/pull/3765) but they are somewhat deep changes and also affect language semantics, so i deferred the work to 0.4.1 or later
Version Information
vyper --version
): 0.4.0rc2+commit.6f09e296Issue description and/or POC
The compilation of the example above will throw
vyper.exceptions.InvalidType: Value and target type are both 'Bytes[11]'
instead ofvyper.exceptions.TypeMismatch: Can't convert Bytes[10] to Bytes[11]
The first condition in the
_cast_bytestring
function can't be reachedDue to the check in the
Convert::infer_arg_types
:Which is triggered by the
_BytestringT
comparison conditions.How can it be fixed?