changeset 177:491b5fc4782a

Small fixes to type checks.
author Anders Johnsen <skabet@gmail.com>
date Thu, 24 Jul 2008 23:36:10 +0200
parents dc9bf56b7ace
children 5f7e2f2344a5
files sema/AstAction.d sema/TypeCheck.d
diffstat 2 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/sema/AstAction.d	Thu Jul 24 23:03:18 2008 +0200
+++ b/sema/AstAction.d	Thu Jul 24 23:36:10 2008 +0200
@@ -1,6 +1,7 @@
 module sema.AstAction;
 
-import Integer = tango.text.convert.Integer;
+import Integer = tango.text.convert.Integer,
+       tango.io.Stdout;
 
 import lexer.Token;
 
--- a/sema/TypeCheck.d	Thu Jul 24 23:03:18 2008 +0200
+++ b/sema/TypeCheck.d	Thu Jul 24 23:36:10 2008 +0200
@@ -129,7 +129,7 @@
                 {
                     auto argType = sel.type.asFunction.params[i];
                     auto expType = arg.type;
-                    if (argType.byteSize != expType.byteSize)
+                    if (argType.isSame(expType))
                     {
                         if (!expType.hasImplicitConversionTo(argType))
                             messages.report(InvalidImplicitCast, exp.loc)
@@ -222,7 +222,7 @@
             {
                 auto argType = exp.exp.type.asFunction.params[i];
                 auto expType = arg.type;
-                if(argType.byteSize != expType.byteSize)
+                if(!argType.isSame(expType))
                 {
                     if(!expType.hasImplicitConversionTo(argType))
                         messages.report(InvalidImplicitCast, exp.loc)
@@ -266,7 +266,7 @@
             {
                 auto argType = sel.type.asFunction.params[i];
                 auto expType = arg.type;
-                if (argType.byteSize != expType.byteSize)
+                if (!argType.isSame(expType))
                 {
                     if (!expType.hasImplicitConversionTo(argType))
                         messages.report(InvalidImplicitCast, exp.loc)
@@ -329,7 +329,7 @@
         {
             auto returnType = stmt.env.parentFunction.type.asFunction.returnType;
             auto expType = stmt.exp.type;
-            if(returnType != expType)
+            if(!returnType.isSame(expType))
             {
                 if(!expType.hasImplicitConversionTo(returnType))
                    messages.report(InvalidImplicitCast, stmt.exp.loc)
@@ -354,7 +354,7 @@
         {
             auto varType = decl.identifier.type;
             auto expType = decl.init.type;
-            if(varType.byteSize != expType.byteSize)
+            if(!varType.isSame(expType))
             {
                 if(!expType.hasImplicitConversionTo(varType))
                    messages.report(InvalidImplicitCast, decl.init.loc)
@@ -396,7 +396,7 @@
             {
                 auto argType = s.type.asFunction.params[i];
                 auto expType = arg.type;
-                if (argType != expType)
+                if (argType.isSame(expType))
                 {
                     per = false;
                     if( !expType.hasImplicitConversionTo(argType) )