boltlang / Bolt

A programming language for rapid application development
35 stars 1 forks source link

Improve resolution of conflicts when overloads and variable declarations occur in nested scopes #20

Closed samvv closed 3 years ago

samvv commented 3 years ago

Currently, the following code could in theory be accepted:

let foo = |x: Int| 1;

fn foo(n: String) {
   return 2;
}

1.foo();

Right now, depending on how let foo and fn foo are stored, either declaration might become the resolved candidate. This should be changed so that local variable declarations always get precedence over overloads.

Fixing this bug will require some changes in how TypeEnv.getSchemes() is used. Right now this function returns both local schemes and those schemes that are in the parent typing environment. We will need to explicitly traverse the typing environments by hand and break whenever type.overloaded is false.

samvv commented 3 years ago

Not going to fix this in this repository.