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

sum-types: Implement missing cases for PTyped and PLocated #1609

Closed
RyanGlScott opened this issue Jan 19, 2024 · 1 comment
Closed

sum-types: Implement missing cases for PTyped and PLocated #1609

RyanGlScott opened this issue Jan 19, 2024 · 1 comment
Labels
bug Something not working correctly enums Issues related to enums renamer Issues related to scoping and name resolution. typechecker Issues related to type-checking Cryptol code.

Comments

@RyanGlScott
Copy link
Contributor

On the sum-types branch (#1602), there are some places in the code that are missing cases for PTyped and PLocated. These include:

  • The BindsName (Pattern PName) instance:

    instance BindsNames (Pattern PName) where
    namingEnv pat =
    case pat of
    PVar x -> BuildNamingEnv (
    do y <- newLocal NSValue (thing x) (srcRange x)
    pure (singletonNS NSValue (thing x) y)
    )
    PCon _ xs -> mconcat (map namingEnv xs)
    _ -> panic "namingEnv" ["Unexpected pattern"]

  • The checkCaseAlt function:

    instance BindsNames (Pattern PName) where
    namingEnv pat =
    case pat of
    PVar x -> BuildNamingEnv (
    do y <- newLocal NSValue (thing x) (srcRange x)
    pure (singletonNS NSValue (thing x) y)
    )
    PCon _ xs -> mconcat (map namingEnv xs)
    _ -> panic "namingEnv" ["Unexpected pattern"]

There may be others—check to see if -Wincomplete-patterns warns about other missing cases for PTyped and PLocated.

@RyanGlScott RyanGlScott added bug Something not working correctly enums Issues related to enums typechecker Issues related to type-checking Cryptol code. renamer Issues related to scoping and name resolution. labels Jan 19, 2024
@RyanGlScott
Copy link
Contributor Author

Done in a0179c0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something not working correctly enums Issues related to enums renamer Issues related to scoping and name resolution. typechecker Issues related to type-checking Cryptol code.
Projects
None yet
Development

No branches or pull requests

1 participant