Browse Source

Added float and double types to builtin types

Added floating point test case
constants
Tristan B. V. Kildaire 7 months ago
parent
commit
c561060470
  1. 12
      source/tlang/compiler/symbols/typing/builtins.d
  2. 3
      source/tlang/testing/typecheck/simple_float_constant.t

12
source/tlang/compiler/symbols/typing/builtins.d

@ -57,6 +57,18 @@ public Type getBuiltInType(TypeChecker tc, string typeString)
{
return new Void();
}
/* TODO: Decide on these (floats and doubles need to be specced out) */
/* `float` */
else if(cmp(typeString, "float") == 0)
{
return new Float("float", 4);
}
/* `double` */
else if(cmp(typeString, "double") == 0)
{
return new Float("double", 8);
}
/* TODO: What do we want? Char enforcement is kind of cringe I guess */
else if(cmp(typeString, "char") == 0)

3
source/tlang/testing/typecheck/simple_float_constant.t

@ -0,0 +1,3 @@
module simple;
float df;
Loading…
Cancel
Save