浏览代码

Fixed method override in generic extensions

Brian Fiete 3 年之前
父节点
当前提交
f2b177693d
共有 2 个文件被更改,包括 13 次插入1 次删除
  1. 1 1
      IDEHelper/Compiler/BfModule.cpp
  2. 12 0
      IDEHelper/Tests/src/Extensions.bf

+ 1 - 1
IDEHelper/Compiler/BfModule.cpp

@@ -24355,7 +24355,7 @@ void BfModule::DoMethodDeclaration(BfMethodDeclaration* methodDeclaration, bool
 				auto checkMethodInstance = typeInstance->mMethodInstanceGroups[checkMethod->mIdx].mDefault;				
 				auto checkMethodInstance = typeInstance->mMethodInstanceGroups[checkMethod->mIdx].mDefault;				
 				if (checkMethodInstance == NULL)
 				if (checkMethodInstance == NULL)
 				{
 				{
-					if ((methodDef->mIsNew) && (methodDef->mDeclaringType->IsExtension()) && (!checkMethod->mDeclaringType->IsExtension()))
+					if ((methodDef->mDeclaringType->IsExtension()) && (!checkMethod->mDeclaringType->IsExtension()))
 						checkMethodInstance = GetRawMethodInstanceAtIdx(typeInstance, checkMethod->mIdx);
 						checkMethodInstance = GetRawMethodInstanceAtIdx(typeInstance, checkMethod->mIdx);
 					if (checkMethodInstance == NULL)
 					if (checkMethodInstance == NULL)
 						continue;
 						continue;

+ 12 - 0
IDEHelper/Tests/src/Extensions.bf

@@ -267,6 +267,18 @@ namespace Tests
 		    }
 		    }
 		}
 		}
 
 
+		struct TestExtern<T>
+		{
+			public extern void MethodA();
+		}
+
+		extension TestExtern<T> where T : Char8
+		{
+			public override void MethodA()
+			{
+			}
+		}
+
 		[Test]
 		[Test]
 		public static void TestBasics()
 		public static void TestBasics()
 		{
 		{