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

fix error message for unmatched parameterized type variable #250

Merged
merged 1 commit into from
Apr 2, 2019

Conversation

davidchambers
Copy link
Member

@davidchambers davidchambers commented Mar 31, 2019

Commit message:

Consider the following type error:

def ('!') ({}) ([$.UnaryTypeVariable ('f') ($.String)]) (() => 8) ()

Incorrect error message (before):

Type-variable constraint violation

! :: () -> f String
           ^^^^^^^^
              1

1)  8 :: Number

Since there is no type of which all the above values are members, the type-variable constraint has been violated.

Correct error message (after):

Invalid value

! :: () -> f String
           ^^^^^^^^
              1

1)  8 :: Number

The value at position 1 is not a member of ‘f String’.

⚠️ The fix requires changing predicates from Any -> Boolean to Array Type -> Any -> Boolean.

Consider the following type error:

    def ('!') ({}) ([$.UnaryTypeVariable ('f') ($.String)]) (() => 8) ()

Incorrect error message (before):

    Type-variable constraint violation

    ! :: () -> f String
               ^^^^^^^^
                  1

    1)  8 :: Number

    Since there is no type of which all the above values are members,
    the type-variable constraint has been violated.

Correct error message (after):

    Invalid value

    ! :: () -> f String
               ^^^^^^^^
                  1

    1)  8 :: Number

    The value at position 1 is not a member of ‘f String’.
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.

2 participants