Skip to content

Improve error message when using optional types in bounced<> #3447

@Gusarich

Description

@Gusarich

The current compiler error message when using an optional message type (MyMsg?) inside the bounced<> constructor is imprecise and unclear.

Minimal reproducible snippet:

message MyMsg {}

contract TestContract {
    bounced(msg: bounced<MyMsg?>) {
        // Do nothing
    }
    receive() {}
}

Current compiler error:

Error: Only named type can be bounced<>

Suggested improved error message:

Error: Optional types cannot be used with bounced<>, remove '?' from 'MyMsg?'

Explanation:
The existing error message incorrectly implies the issue is about naming, rather than optionality. A clearer error message explicitly indicating the problem is due to using an optional type would better guide developers in resolving this issue.


LLM Fuzzing discovery (see #2490)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions