Fix typos.
This commit is contained in:
@@ -32,7 +32,7 @@ public class BooleanType extends PrimitiveType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Every remaining type will throw a RuntimeException
|
// Every remaining type will throw a RuntimeException
|
||||||
throw new RuntimeException("Type missmatch: cannot combine " + this.getName() + " and " + that.getName());
|
throw new RuntimeException("Type mismatch: cannot combine " + this.getName() + " and " + that.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public class FloatType extends NumericType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Every remaining type will throw a RuntimeException
|
// Every remaining type will throw a RuntimeException
|
||||||
throw new RuntimeException("Type missmatch: cannot combine " + this.getName() + " and " + that.getName());
|
throw new RuntimeException("Type mismatch: cannot combine " + this.getName() + " and " + that.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public class IntegerType extends NumericType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Every remaining type will throw a RuntimeException
|
// Every remaining type will throw a RuntimeException
|
||||||
throw new RuntimeException("Type missmatch: cannot combine " + this.getName() + " and " + that.getName());
|
throw new RuntimeException("Type mismatch: cannot combine " + this.getName() + " and " + that.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public class NullType extends Type {
|
|||||||
public Type combine(Type that) {
|
public Type combine(Type that) {
|
||||||
// You can not combine null with a primitive type
|
// You can not combine null with a primitive type
|
||||||
if (that.isPrimitiveType()) {
|
if (that.isPrimitiveType()) {
|
||||||
throw new RuntimeException("Type missmatch: cannot combine " + this.getName() + " and " + that.getName());
|
throw new RuntimeException("Type mismatch: cannot combine " + this.getName() + " and " + that.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Everything else combines with null to the type it was before
|
// Everything else combines with null to the type it was before
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public class ConstructorCallTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void numConstructorParameterMissmatch() {
|
void numConstructorParametermismatch() {
|
||||||
ParseTree tree = Helper.prepareParser("struct bar { a: int; } function foo(): bar { return create bar(1, false); } foo();");
|
ParseTree tree = Helper.prepareParser("struct bar { a: int; } function foo(): bar { return create bar(1, false); } foo();");
|
||||||
var funcs = Helper.getFuncs(tree);
|
var funcs = Helper.getFuncs(tree);
|
||||||
var structs = Helper.getStructs(tree);
|
var structs = Helper.getStructs(tree);
|
||||||
@@ -41,6 +41,6 @@ public class ConstructorCallTest {
|
|||||||
ContextAnalysis ctxAnal = new ContextAnalysis(funcs, structs, enums);
|
ContextAnalysis ctxAnal = new ContextAnalysis(funcs, structs, enums);
|
||||||
|
|
||||||
Exception e = assertThrows(RuntimeException.class, () -> ctxAnal.visit(tree));
|
Exception e = assertThrows(RuntimeException.class, () -> ctxAnal.visit(tree));
|
||||||
assertEquals("Error in line 1:63 argument 0 Type missmatch: cannot combine bool and int", e.getMessage());
|
assertEquals("Error in line 1:63 argument 0 Type mismatch: cannot combine bool and int", e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -33,7 +33,7 @@ public class FunctionCallTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void parameterTypeMissmatch() {
|
void parameterTypeMismatch() {
|
||||||
ParseTree tree = Helper.prepareParser("function foo(x: int): int { return x; } foo(false);");
|
ParseTree tree = Helper.prepareParser("function foo(x: int): int { return x; } foo(false);");
|
||||||
var funcs = Helper.getFuncs(tree);
|
var funcs = Helper.getFuncs(tree);
|
||||||
var structs = Helper.getStructs(tree);
|
var structs = Helper.getStructs(tree);
|
||||||
|
|||||||
Reference in New Issue
Block a user