Quellcode durchsuchen

Improved error description. Fixes #345.

woollybah vor 7 Jahren
Ursprung
Commit
b909af1ef0
1 geänderte Dateien mit 19 neuen und 1 gelöschten Zeilen
  1. 19 1
      decl.bmx

+ 19 - 1
decl.bmx

@@ -3076,6 +3076,7 @@ End Rem
 					For Local decl:TFuncDecl=EachIn iface.SemantedMethods()
 					For Local decl:TFuncDecl=EachIn iface.SemantedMethods()
 						Local found:Int
 						Local found:Int
 
 
+						Local voidReturnTypeFail:Int
 						Local cdecl:TClassDecl=Self
 						Local cdecl:TClassDecl=Self
 						
 						
 						While cdecl And Not found
 						While cdecl And Not found
@@ -3089,6 +3090,19 @@ End Rem
 									End If
 									End If
 									found=True
 									found=True
 									Exit
 									Exit
+								Else
+									If decl2.EqualsArgs( decl, False ) Then
+										If TVoidType(decl.retType) And TIntType(decl2.retType) Then
+											' if we are only strict, we may fail on type mismatch
+											If Not ModuleScope().IsSuperStrict() Then
+												' we have the option of upgrading our return type to match superstrict parent
+												If Not opt_strictupgrade Then
+													voidReturnTypeFail = True
+												End If
+											End If
+										End If
+
+									End If
 								EndIf
 								EndIf
 							Next
 							Next
 						
 						
@@ -3096,7 +3110,11 @@ End Rem
 						Wend
 						Wend
 
 
 						If Not found
 						If Not found
-							Err decl.ToString() + " must be implemented by type " + ToString()
+							Local errorDetails:String = decl.ToString() + " must be implemented by type " + ToString()
+							If voidReturnTypeFail Then
+								errorDetails :+ " You may have Strict type overriding SuperStrict type. "
+							End If
+							Err errorDetails
 						EndIf
 						EndIf
 					Next
 					Next
 				Next
 				Next