Disambiguation
- Type Disambiguation
- Expression Disambiguation
Static Checks
Typechecker
- Insert inference variables into AST
- Accumulate constraints on inference variables and infer static params
- Solve constraints and substitute solutions
- Resolve overloading and typecheck
Discussion
- When we solve constraints vartypes are out of scope so it is impossible to get any information about them. At the moment we solve this by solving for all the bounds on vartypes whenever we leave the scope where they were introduced. There is probably another way to do this.
- Even without disjunctions we use too much memory. This may be due to huge intersections. At the moment in applicationType and findMethodInTraitHierarchy we normalize intersections.
- The methods applicationType and findMethodInTraitHierarchy are very similar. Specifically, we are going through each argument type in findMethodInTraitHierarchy when we could just treat the whole thing as a tupple and do a subtype check. We didn't know that VarArgs types worked properly in the TypeAnalyser.
- In second pass we always 'close constraints' where they are created. They are created at function/op call sites, generator bindings, assignments, case expressions, and maybe a few other places.
- The way that we handle functional method which capture VarTypes may be crappy. (Sometimes we even replace VarTypes with inference variables even though the VarType is still in scope for example if we use = on two objects of type T inside the trait Equality[\T\].)
- In forChainExpr we require that all operators have type boolean even though the spec does not explicitly require this
- Currently the way that we handle choosing overloadings is messy in particular the stuff you do before calling find statically most applicable type
- We filter out APIs from the global environment that should not be visible for the purposes of disambiguation in TopLevelEnvironment.
- The maps/methods in the TopLevelEnvironment are poorly named for their current function. We no longer separate OnDemand and explicitlyImported, they are all just imports.
Partially Implemented
- In order to improve the quality of overloading selection, every time we have a node that binds and then recurs we need to pass our constraints down. We do this already for LocalVarDecls and the parameters of operators methods and functions.
- Subtyping of var types
- Explicit instantiations of inferred static args: We did it for several cases, OpExpr, _RewriteFnApp, CaseExpr, Assignment, but we have not yet done it for MethodInvocation and SubscriptExprs.
To Do
- Do string check for Juxt in second pass.
- Inference of nat, int, and bool parameters
- Keyword args
- Check .fsi files
- Make StaticParamTypeEnv handle where clauses
- ExtremumExpressions (we need total operator order)
- We need to implement calling methods on union types
- Make sure that as we have modified nodes the factories have stayed consistent
- Aliased imports
Questions
- What do we do about arrayk for k>3
- How do opr parameters work
Download in other formats: