johns-branch #17

Merged
i22005 merged 17 commits from johns-branch into main 2024-07-01 21:08:24 +00:00
4 changed files with 46 additions and 5 deletions
Showing only changes of commit 4d21d8e94e - Show all commits

View File

@ -214,9 +214,7 @@ public class SemanticAnalyzer implements SemanticVisitor {
@Override
public TypeCheckResult analyze(ParameterNode toCheck) {
return new TypeCheckResult(true, null);
return new TypeCheckResult(true, toCheck.type);
}
@Override
@ -517,7 +515,7 @@ public class SemanticAnalyzer implements SemanticVisitor {
for(int i = 0; i < method.getParameters().size(); i++){
var result1 = method.getParameters().get(i).accept(this);
var result2 = toCheck.parameters.get(i).accept(this);
if (Objects.equals(result1.getType(), result2.getType())) {
if (!Objects.equals(result1.getType(), result2.getType())) {
same = false;
}
}

View File

@ -0,0 +1,22 @@
// @expected: TypeMismatchException
public class Test{
public int i;
public boolean b;
public int test(){
return this.test(i);
}
public void test(int a){
}
public int test(boolean bool){
int ret = 1;
return ret;
}
}

View File

@ -5,7 +5,7 @@ public class Test{
public int test(){
return i;
return this.test(b);
}

View File

@ -0,0 +1,21 @@
public class Test{
public int i;
public boolean b;
public int test(){
return this.test(b);
}
public void test(int a){
}
public int test(boolean bool){
int ret = 1;
return ret;
}
}