From f44295e8eaaa0bdca8f1c5f74dbb9aff8c9ab5e6 Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Fri, 22 Mar 2024 07:47:39 -0400 Subject: [PATCH] Don't allow conversions for type constraint matches --- IDEHelper/Compiler/BfModule.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/IDEHelper/Compiler/BfModule.cpp b/IDEHelper/Compiler/BfModule.cpp index 5b76c676..e8b9b0f9 100644 --- a/IDEHelper/Compiler/BfModule.cpp +++ b/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; } }