Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add internal type-alias type for improved error messages #18577

Closed
wants to merge 2 commits into from

Conversation

Vexu
Copy link
Member

@Vexu Vexu commented Jan 15, 2024

This doesn't work yet as I'd like to get approval for the concept before continuing but the goal is to (at least partially) solve #12401 by making error messages refer to the types the same way as the programmer does:

const Foo = u32; // note: type alias declared here
comptime {
    const b: Foo = 32;
    b and true; // error: expected type 'bool', found 'Foo'
}

The first commit is a general improvement required for this feature but also works separately.

This ensures that the note is added in more places and that `errMsg` needs to be used in fewer places.
@Vexu Vexu requested a review from Snektron as a code owner January 15, 2024 20:24
@Vexu
Copy link
Member Author

Vexu commented Jan 16, 2024

Rejected for complicating the compiler too much, and to possibly add an user accessible feature that provides the same benefit: #5132, #1595.

I'll open a new PR for the first commit.

@Vexu Vexu closed this Jan 16, 2024
@Vexu Vexu deleted the type-alias branch January 16, 2024 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant