Skip to content

Resolution of constructor names #402

@favonia

Description

@favonia

Proposal

NameRes should associate each constructor name to a list of {datatype : Name.t; clbl : string} which represents all possible interpretations. This will automatically support renaming, namespaces, shadowing, etc., correctly. A type checker should first consult the name resolver and then use typing information to disambiguate overloaded constructors if needed.

favonia: I think the following example should be forbidden due to self-shadowing:

data tt where tt

Spec of shadowing

These should work:

data bool where tt | ff
def tt : bool = ff
def x : [i] bool [i=0 -> tt | i=1 -> ff] = refl
data bool where tt | ff
def mybool : type = bool
def bool : type^1 = type
def x : mybool = tt

These should not work:

data bool where tt | ff
def tt : type^1 = type
data unit where tt
def x : bool = tt

These I do not know:

data bool where tt | ff
data tt where tt
def x : bool = tt

Thoughts? @ecavallo @jonsterling @cangiuli

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions