From dad185f96f91cc4122fece5162956e0ac9746fb5 Mon Sep 17 00:00:00 2001 From: "Tristan B. Velloza Kildaire" Date: Fri, 21 Apr 2023 15:23:24 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=EF=B8=8F=20isSameType:=20Add=20a?= =?UTF-8?q?=20base=20case=20(#8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Core - Added a TODO where we are meant to insert the fallback check in `isSameType(Type t1, Type t2)` * TypeChecker - Added backported `isSameType(Type 1, Type t2)` fix for #114 --- source/tlang/compiler/typecheck/core.d | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/tlang/compiler/typecheck/core.d b/source/tlang/compiler/typecheck/core.d index 4519ac48..0dd78120 100644 --- a/source/tlang/compiler/typecheck/core.d +++ b/source/tlang/compiler/typecheck/core.d @@ -316,6 +316,9 @@ public final class TypeChecker { bool same = false; + // NOTE: We compare actual types, then check which type + // ... the order is important due to type hierachy + /* Handling for pointers */ if(typeid(type1) == typeid(type2) && cast(Pointer)type1 !is null) { @@ -341,6 +344,11 @@ public final class TypeChecker same = false; } } + /* Handling for all other cases */ + else if(typeid(type1) == typeid(type2)) + { + return true; + } gprintln("isSameType("~to!(string)(type1)~","~to!(string)(type2)~"): "~to!(string)(same), DebugType.ERROR); return same;