-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
bugSomething isn't workingSomething isn't working
Description
The current implementation places all data constructor names in the global scope. We do not check for duplicated data constructor names, and in the case where duplicates are present, one overwrites the other:
Fails
data Foo = Baz;
data Bar = Baz;
function main() {
let x = Baz;
let y : Foo = Baz;
}
Types do not match: Bar and Foo
- in:let y : Foo = Baz ;
- in:function main () {
let x = Baz ;
let y : Foo = Baz ;
}
Accepted
data Foo = Baz;
data Bar = Baz;
function main() {
let x = Baz;
let y : Bar = Baz;
}
Solution
Implement a namespace for all data constuctors (e.g. Foo.Baz
and Bar.Baz
) allowing duplication. Consider sugar (e.g. The .
operator in lean, or c++ style ADL) to allow omitting the namespace qualifier in cases where a unique namespace can be inferred from the context.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working