Skip to content

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

@RyanGlScott

Description

@RyanGlScott

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething not working correctlyenumsIssues related to enumsrenamerIssues related to scoping and name resolution.typecheckerIssues related to type-checking Cryptol code.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions