Skip to content

[Bug] CALL_TYPE_MISMATCH_ERROR when using a lambda for a generic type with key ability #19393

@zzjas

Description

@zzjas

🐛 Bug

//# publish
module 0xa::test {
    fun require_key<T: key + drop>(_x: T) { }

    fun bad() {
        require_key(|| 1u64);
    }
}

Compiling this gives:

bug: bytecode verification failed with unexpected status code `CALL_TYPE_MISMATCH_ERROR`:
Error message: none
  ┌─ .../sources/test.move:6:9
  │
6 │         require_key(|| 1u64);
  │         ^^^^^^^^^^^^^^^^^^^^
  │

Analysis from Claude Code

In third_party/move/move-model/src/ty.rs:

  • default_type_for applies key to Fun type without guard
  • Constraint::join lacks SomeFunctionValue + HasAbilities({key}) rejection

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions