TypL
TypL copied to clipboard
Lookup mappings for TypeIDs
Define lookup mappings from typeID (like "int") to friendly type names (like "integer") for the purposes of error messages.
Similar to getTypeID(..). Like this:
getTypeName("int"); // "integer"
getTypeName({ inferred: "int" }); // "integer"
Is this needed though? Java also reports type mismatches with the same keyword as it is used in the code.
public class HelloWorld{
public static void main(String []args){
System.out.println("Hello World");
String a = "a";
int b = 1;
a = b;
float c = a - b;
}
}
$javac HelloWorld.java
HelloWorld.java:7: error: incompatible types: int cannot be converted to String
a = b;
^
HelloWorld.java:8: error: bad operand types for binary operator '-'
float c = a - b;
^
first type: String
second type: int
2 errors
Some of the type-ids are shortened (for the purposes of usability, mostly), which can make them a tad cryptic in error messages. Example: 'bint' ("bigint"). Also, "nul" looks weird in error messages, but had to be with one "l" because it's a reserved keyword.
Yeah for 'bint' and 'nul' I agree.