From 10c0ac3bf06ab31ee2df008a50c18c9dd146c751 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Strehovsk=C3=BD?= Date: Thu, 22 Jan 2026 00:07:29 -0800 Subject: [PATCH] Be careful about getExactClasses of variant types https://github.com/dotnet/runtime/pull/123112 started running more outerloop tests, including: https://github.com/dotnet/runtime/blob/81e28e28a7dd0c5109f8a3c0e458d3de577e78f8/src/tests/JIT/Methodical/flowgraph/dev10_bug679008/sealedCastVariance.cs#L13-L32 We were incorrectly optimizing the `a.GetType() == typeof(Action)` check to `false` (type of the parameter is `Action` and JIT was asking for exact classes of `Action`; and there are none). --- .../aot/ILCompiler.RyuJit/JitInterface/CorInfoImpl.RyuJit.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/tools/aot/ILCompiler.RyuJit/JitInterface/CorInfoImpl.RyuJit.cs b/src/coreclr/tools/aot/ILCompiler.RyuJit/JitInterface/CorInfoImpl.RyuJit.cs index 92e0d41bd92677..c64ff0f1b49699 100644 --- a/src/coreclr/tools/aot/ILCompiler.RyuJit/JitInterface/CorInfoImpl.RyuJit.cs +++ b/src/coreclr/tools/aot/ILCompiler.RyuJit/JitInterface/CorInfoImpl.RyuJit.cs @@ -2282,7 +2282,7 @@ private bool CanNeverHaveInstanceOfSubclassOf(TypeDesc type) private int getExactClasses(CORINFO_CLASS_STRUCT_* baseType, int maxExactClasses, CORINFO_CLASS_STRUCT_** exactClsRet) { MetadataType type = HandleToObject(baseType) as MetadataType; - if (type == null) + if (type == null || type.HasVariance) { return -1; }