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

Signature / structure type mismatch location #57

Open
vqns opened this issue May 2, 2024 · 1 comment
Open

Signature / structure type mismatch location #57

vqns opened this issue May 2, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@vqns
Copy link

vqns commented May 2, 2024

Environment

Steps to reproduce

Structure / signature type mismatch for a given identifier seems to be reported at the start of the structure (i.e at the struct keyword) and only mentions incompatible types (5006). Example:

structure S :
sig
    val i : int
end =
struct
(* ^ error here *)
    val i = ""
end

Expected behavior

If possible, the location of the diagnostic should be that of the declaration in the structure. Or maybe mentioning either the identifier or the positions of the mismatching declarations in the diagnostic message?

Actual behavior

incompatible types: `int` and `string` are different type constructors
  expected `int`
    found `string` Millet(5006)
@vqns vqns added the bug Something isn't working label May 2, 2024
@azdavis
Copy link
Owner

azdavis commented May 4, 2024

yeah, this is an old todo:

//! TODO improve error messages/ranges. for ranges, we might need to track `sml_hir::Idx`es either

it's definitely possible in common cases like this, it would just require us to be better about knowing what Idx to emit errors onto.

going to mark this as a feature request since it's not really a bug - the feature as of now works, just suboptimally.

@azdavis azdavis added enhancement New feature or request and removed bug Something isn't working labels May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants