Implement GetNonRuntimeDeterminedTypeFromRuntimeDeterminedSubtypeViaSubstitution...
authorMichal Strehovský <MichalStrehovsky@users.noreply.github.com>
Tue, 16 May 2023 17:40:18 +0000 (02:40 +0900)
committerGitHub <noreply@github.com>
Tue, 16 May 2023 17:40:18 +0000 (10:40 -0700)
This was reached in the Pri0 test suite.

src/coreclr/tools/Common/TypeSystem/RuntimeDetermined/FunctionPointerType.RuntimeDetermined.cs

index 5f2d9b5..480c4f4 100644 (file)
@@ -24,8 +24,12 @@ namespace Internal.TypeSystem
 
         public override TypeDesc GetNonRuntimeDeterminedTypeFromRuntimeDeterminedSubtypeViaSubstitution(Instantiation typeInstantiation, Instantiation methodInstantiation)
         {
-            Debug.Assert(false);
-            return this;
+            var sigBuilder = new MethodSignatureBuilder(_signature);
+            sigBuilder.ReturnType = _signature.ReturnType.GetNonRuntimeDeterminedTypeFromRuntimeDeterminedSubtypeViaSubstitution(typeInstantiation, methodInstantiation);
+            for (int i = 0; i < _signature.Length; i++)
+                sigBuilder[i] = _signature[i].GetNonRuntimeDeterminedTypeFromRuntimeDeterminedSubtypeViaSubstitution(typeInstantiation, methodInstantiation);
+            MethodSignature newSig = sigBuilder.ToSignature();
+            return newSig == _signature ? this : Context.GetFunctionPointerType(newSig);
         }
     }
 }