Browse Source

Fix matchesExact check only comparing minimum amount of parametters

kindlich 4 years ago
parent
commit
1d0289c19f
No known key found for this signature in database

+ 7
- 6
CodeModel/src/main/java/org/openzen/zenscript/codemodel/FunctionHeader.java View File

@@ -239,12 +239,13 @@ public class FunctionHeader {
239 239
 			return false;
240 240
 		
241 241
 		FunctionHeader header = fillGenericArguments(position, scope, arguments.typeArguments);
242
-		for (int i = 0; i < header.minParameters; i++) {
243
-			if (!arguments.arguments[i].type.equals(header.parameters[i].type))
244
-				return false;
245
-		}
246
-		
247
-		return true;
242
+        final boolean variadicCall = header.isVariadicCall(arguments, scope);
243
+        for(int i = 0; i < arguments.arguments.length; i++) {
244
+            if(!arguments.arguments[i].type.equals(header.getParameterType(variadicCall, i)))
245
+                return false;
246
+        }
247
+        
248
+        return true;
248 249
 	}
249 250
 	
250 251
 	public boolean matchesImplicitly(CodePosition position, CallArguments arguments, TypeScope scope) {

Loading…
Cancel
Save