Skip to content

Commit 568b115

Browse files
committed
Apply change to all bottom types
1 parent 5f79048 commit 568b115

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

compiler/src/dotty/tools/dotc/typer/Applications.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1689,7 +1689,7 @@ trait Applications extends Compatibility {
16891689
if selType <:< unapplyArgType then
16901690
unapp.println(i"case 1 $unapplyArgType ${ctx.typerState.constraint}")
16911691
fullyDefinedType(unapplyArgType, "pattern selector", tree.srcPos)
1692-
if selType.isNothingType then unapplyArgType
1692+
if selType.isBottomType then unapplyArgType
16931693
else selType.dropAnnot(defn.UncheckedAnnot) // need to drop @unchecked. Just because the selector is @unchecked, the pattern isn't.
16941694
else
16951695
if !ctx.mode.is(Mode.InTypeTest) then
@@ -1712,7 +1712,7 @@ trait Applications extends Compatibility {
17121712
val unapplyPatterns = UnapplyArgs(unapplyApp.tpe, unapplyFn, unadaptedArgs, tree.srcPos)
17131713
.typedPatterns(qual, this)
17141714
val result = assignType(cpy.UnApply(tree)(newUnapplyFn, unapplyImplicits(dummyArg, unapplyApp), unapplyPatterns), ownType)
1715-
if (ownType.stripped eq selType.stripped) || selType.isNothingType || ownType.isError then result
1715+
if (ownType.stripped eq selType.stripped) || selType.isBottomType || ownType.isError then result
17161716
else tryWithTypeTest(Typed(result, TypeTree(ownType)), selType)
17171717
case tp =>
17181718
val unapplyErr = if (tp.isError) unapplyFn else notAnExtractor(unapplyFn)

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2816,7 +2816,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
28162816
if isStableIdentifierOrLiteral || isNamedTuplePattern then pt
28172817
else if isWildcardStarArg(body1)
28182818
|| pt == defn.ImplicitScrutineeTypeRef
2819-
|| pt.isNothingType
2819+
|| pt.isBottomType
28202820
|| body1.tpe <:< pt // There is some strange interaction with gadt matching.
28212821
// and implicit scopes.
28222822
// run/t2755.scala fails to compile if this subtype test is omitted
@@ -3556,7 +3556,10 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
35563556
def typedTuple(tree: untpd.Tuple, pt: Type)(using Context): Tree =
35573557
val tree1 = desugar.tuple(tree, pt).withAttachmentsFrom(tree)
35583558
checkDeprecatedAssignmentSyntax(tree)
3559-
if tree1 ne tree then typed(tree1, pt)
3559+
if tree1 ne tree then
3560+
val t = typed(tree1, pt)
3561+
// println(i"typedTuple: ${t} , ${t.tpe}")
3562+
t
35603563
else
35613564
val arity = tree.trees.length
35623565
val pts = pt.stripNamedTuple.tupleElementTypes match

0 commit comments

Comments
 (0)