Browse Source

Binary operator expressions now work

constants
Tristan B. V. Kildaire 10 months ago
parent
commit
ba63f85df9
  1. 15
      source/tlang/compiler/typecheck/core.d
  2. 1
      source/tlang/testing/typecheck/simple_1.t
  3. 9
      test.d

15
source/tlang/compiler/typecheck/core.d

@ -310,6 +310,21 @@ public final class TypeChecker
*/
Type vRhsType = popType();
Type vLhsType = popType();
/**
* TODO:
* Types must either BE THE SAME or BE COMPATIBLE
*/
if(isSameType(vLhsType, vRhsType))
{
/* Left type + Right type = left/right type (just use left - it doesn't matter) */
addType(vLhsType);
}
else
{
gprintln("Binary operator expression requires both types be same, but got '"~vRhsType.toString()~"' and '"~vLhsType.toString()~"'", DebugType.ERROR);
assert(false);
}
/**

1
source/tlang/testing/typecheck/simple_1.t

@ -1,6 +1,7 @@
module simple;
int j = 1+func(2,test());
j = 2+func(2,test());
int func(int x1, byte x2)
{

9
test.d

@ -21,13 +21,6 @@ asm
asm
{
mov RSP, R15;
mov R13B, 65;
}
int h = -1;
h = *((&h)-4);
import std.stdio;
writeln(h);
}

Loading…
Cancel
Save