浏览代码

Don't allow conversions for type constraint matches

Brian Fiete 1 年之前
父节点
当前提交
f44295e8ea
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      IDEHelper/Compiler/BfModule.cpp

+ 3 - 3
IDEHelper/Compiler/BfModule.cpp

@@ -8693,7 +8693,7 @@ bool BfModule::CheckGenericConstraints(const BfGenericParamSource& genericParamS
 				else if ((checkArgType->IsFunction()) && (convCheckConstraint->IsInstanceOf(mCompiler->mFunctionTypeDef)))
 					constraintMatched = true;
 			}
-			else if (CanCast(GetFakeTypedValue(checkArgType), convCheckConstraint))
+			else if ((checkArgType == convCheckConstraint) || (TypeIsSubTypeOf(checkArgType->ToTypeInstance(), convCheckConstraint->ToTypeInstance())))
 			{
 				constraintMatched = true;
 			}
@@ -8719,8 +8719,8 @@ bool BfModule::CheckGenericConstraints(const BfGenericParamSource& genericParamS
 
 				if (!constraintMatched)
 				{
-					BfType* wrappedStructType = GetWrappedStructType(origCheckArgType, false);
-					if (CanCast(GetFakeTypedValue(wrappedStructType), convCheckConstraint))
+					BfTypeInstance* wrappedStructType = GetWrappedStructType(origCheckArgType, false);
+					if ((wrappedStructType == convCheckConstraint) || (TypeIsSubTypeOf(wrappedStructType, convCheckConstraint->ToTypeInstance())))
 						constraintMatched = true;
 				}
 			}