Open brmataptos opened 8 months ago
Another test case to add for this issue (taken from third_party/move/move-compiler-v2/tests/bytecode-generator/wildcard1.move
from this PR: https://github.com/aptos-labs/aptos-core/pull/12818):
module 0xc0ffee::m {
fun tup(): (u64, u64) {
(0, 0)
}
public fun bar() {
let _ = tup();
}
}
Here, v1 points to the return type of tup()
, which can be helpful (although the wording used by v1 is probably what we want to use).
🐛 Bug
PR 12223 fixes the error message in third_party/move/move-compiler-v2/tests/checking/typing/assign_wrong_arity.exp but it is still confusing.
The relevant code is:
The new error output is:
which is better than before, but it is still confusing because the real problem is assigning a tuple to a local var at all.
That test output is also failing to error on the previous statement which assigns
()
tox
, since those errors show up later in the compiler, in code generation. The message suggests that the type analysis is giving x a fixed type ofTuple(0)
, whichi is kind of strange.Anyway, this particular error should be easy enough to fix in type analysis by changing the error message if the target seems to be of type
Tuple(0)
.