Skip to content

Commit 9f6d045

Browse files
authored
Merge pull request #249 from scala/backport-lts-3.3-22601
Backport "Avoid crash in uninhab check in Space" to 3.3 LTS
2 parents 00a7ea1 + 4c91a0b commit 9f6d045

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

compiler/src/dotty/tools/dotc/transform/patmat/Space.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ object SpaceEngine {
655655
val superType = child.typeRef.superType
656656
if typeArgs.exists(_.isBottomType) && superType.isInstanceOf[ClassInfo] then
657657
val parentClass = superType.asInstanceOf[ClassInfo].declaredParents.find(_.classSymbol == parent).get
658-
val paramTypeMap = Map.from(parentClass.argTypes.map(_.typeSymbol).zip(typeArgs))
658+
val paramTypeMap = Map.from(parentClass.argInfos.map(_.typeSymbol).zip(typeArgs))
659659
val substArgs = child.typeRef.typeParamSymbols.map(param => paramTypeMap.getOrElse(param, WildcardType))
660660
substArgs
661661
else Nil

tests/pos/i22518.scala

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
sealed trait Foo[T]
2+
class Bar extends Foo[?]
3+
4+
def mkFoo[T]: Foo[T] =
5+
???
6+
7+
def test: Unit =
8+
mkFoo match
9+
case _ => ()

0 commit comments

Comments
 (0)