Browse Source

Some method matching stuff with equals

kindlich 4 years ago
parent
commit
06b0859ce2
No known key found for this signature in database

+ 3
- 1
CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/member/TypeMemberGroup.java View File

374
 			
374
 			
375
 			if (selected == null) {
375
 			if (selected == null) {
376
 				selected = method;
376
 				selected = method;
377
-			} else if(selected.priority == method.priority){
377
+			} else if (selected.member.equals(method.member)) {
378
+                selected = selected.resolve(method);
379
+            } else if(selected.priority == method.priority){
378
 				StringBuilder explanation = new StringBuilder();
380
 				StringBuilder explanation = new StringBuilder();
379
 				FunctionHeader selectedHeader = selected.member.getHeader().instanceForCall(position, scope.getTypeRegistry(), arguments);
381
 				FunctionHeader selectedHeader = selected.member.getHeader().instanceForCall(position, scope.getTypeRegistry(), arguments);
380
 				explanation.append("Function A: ").append(selectedHeader.toString()).append("\n");
382
 				explanation.append("Function A: ").append(selectedHeader.toString()).append("\n");

+ 2
- 2
CodeModel/src/main/java/org/openzen/zenscript/codemodel/type/member/TypeMembers.java View File

453
 	}
453
 	}
454
 	
454
 	
455
 	private boolean areEquivalent(StoredType fromType, StoredType toType) {
455
 	private boolean areEquivalent(StoredType fromType, StoredType toType) {
456
-		if (fromType == toType)
456
+		if (fromType == toType || fromType.equals(toType))
457
 			return true;
457
 			return true;
458
 		if (!fromType.getActualStorage().canCastTo(toType.getActualStorage()) && !toType.getActualStorage().canCastFrom(fromType.getActualStorage()))
458
 		if (!fromType.getActualStorage().canCastTo(toType.getActualStorage()) && !toType.getActualStorage().canCastFrom(fromType.getActualStorage()))
459
 			return false;
459
 			return false;
460
 		
460
 		
461
-		return fromType.type == toType.type;
461
+		return fromType.type.equals(toType.type);
462
 	}
462
 	}
463
 	
463
 	
464
 	public CasterMemberRef getImplicitCaster(StoredType toType) {
464
 	public CasterMemberRef getImplicitCaster(StoredType toType) {

Loading…
Cancel
Save