Browse Source

Assorted compiler fixes.

Mark Sibly 9 years ago
parent
commit
4a782bf3a9
4 changed files with 11 additions and 6 deletions
  1. 2 2
      src/mx2cc/expr.monkey2
  2. 1 1
      src/mx2cc/func.monkey2
  3. 6 1
      src/mx2cc/overload.monkey2
  4. 2 2
      src/mx2cc/type.monkey2

+ 2 - 2
src/mx2cc/expr.monkey2

@@ -91,13 +91,13 @@ Class Expr Extends PNode
 			If generic
 				
 				If Not ctype Or Not ctype.types 'Or ctype.instanceOf
-					Throw New SemantEx( "Type '"+type.Name+"' must be a generic class type" )
+'					Throw New SemantEx( "Type '"+type.Name+"' must be a generic class type" )
 				Endif
 			
 			Else
 			
 				If ctype And ctype.types And Not ctype.instanceOf
-					Throw New SemantEx( "Generic class type '"+ctype.Name+"' is missing type arguments" )
+'					Throw New SemantEx( "Generic class type '"+ctype.Name+"' is missing type arguments" )
 				Endif
 
 			Endif

+ 1 - 1
src/mx2cc/func.monkey2

@@ -114,7 +114,7 @@ Class FuncValue Extends Value
 	Property IsGeneric:Bool()
 		If Not ftype SemantError( "FuncValue.IsGeneric()" )
 		
-		Return ftype.IsGeneric 'Or (types And Not instanceOf)
+		Return ftype.IsGeneric Or (types And Not instanceOf)
 	End
 	
 	Property IsCtor:Bool()

+ 6 - 1
src/mx2cc/overload.monkey2

@@ -35,10 +35,13 @@ Function IsCandidate:Bool( func:FuncValue,ret:Type,args:Type[],infered:Type[] )
 			
 			Local flist:=TCast<FuncListType>( arg )
 			If flist
+			
 				Local ftype:=TCast<FuncType>( argTypes[i] )
 				If Not ftype Return False
-				Local func:=flist.FindOverload( Null,ftype.argTypes )'ftype.retType,ftype.argTypes )
+				
+				Local func:=flist.FindOverload( Null,ftype.argTypes )
 				If Not func Return False
+				
 				arg=func.ftype
 			Endif
 			
@@ -161,6 +164,8 @@ Public
 
 Function FindOverload:FuncValue( funcs:Stack<FuncValue>,ret:Type,args:Type[] )
 
+	If (ret And ret.IsGeneric) Or AnyTypeGeneric( args ) Print "FindOverload - generic types"
+
 	Local candidates:=New Stack<FuncValue>
 	
 	For Local func:=Eachin funcs

+ 2 - 2
src/mx2cc/type.monkey2

@@ -88,8 +88,8 @@ Class Type Extends SNode
 		Return Null
 	End
 	
-	Method InferType:Type( type:Type,args:Type[] ) Virtual
-		If Equals( type ) Return type	
+	Method InferType:Type( type:Type,infered:Type[] ) Virtual
+		If Equals( type ) Return type
 		Return Null
 	End