Describe the bug
The type checker currently does not flag the existence of the following two functions within the same module as an error, whereas overloading solely by return type is not allowed.
str f(node _) = "";
int f(node _) = 1;
The interpreter seems to use the function that is defined first. When importing a module with the above declarations and the following two, the interpreter signals a type error but the module imports fine anyway. Using the variable i results in an UninitalizedVariable error.
public int i = f(""());
void p() { println(i); }
rascal>import BB;
[ERROR] |file:///C:/Users/Rodin/test-project/BB.rsc|(116,11,<10,11>,<10,22>):10:11: Expected int, but got str
Advice: |https://www.rascal-mpl.org/docs/Rascal/Errors/CompileTimeErrors/UnexpectedType|
ok
rascal>i
|prompt:///|(0,1,<1,0>,<1,1>): Uninitialized variable: i
Advice: |https://www.rascal-mpl.org/docs/Rascal/Errors/CompileTimeErrors/UninitializedVariable|
Desktop (please complete the following information):
- VS Code 0.13.6-head4430 (with Rascal 0.43.0-RC14)
Describe the bug
The type checker currently does not flag the existence of the following two functions within the same module as an error, whereas overloading solely by return type is not allowed.
The interpreter seems to use the function that is defined first. When importing a module with the above declarations and the following two, the interpreter signals a type error but the module imports fine anyway. Using the variable
iresults in anUninitalizedVariableerror.Desktop (please complete the following information):