Skip to content

Commit

Permalink
Parser simple expression error recovery change from null to ??? (#…
Browse files Browse the repository at this point in the history
…19103)

Previously, simpleExpr was recovered as `Literal(Constant(null))` which
led to some errors in interactive.

Type inference in Scala 3 works on whole chain, thus type vars were
inferred as union type of `Null` because of this very reason. Recovering
such errors as `unimplementedExpr` which has a type of `Nothing`, solves
the issue.
  • Loading branch information
dwijnand authored and WojciechMazur committed Jun 25, 2024
1 parent ad05c50 commit 42e8c0c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions compiler/src/dotty/tools/dotc/core/Definitions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -947,6 +947,7 @@ class Definitions {
def TupleXXLModule(using Context): Symbol = TupleXXLClass.companionModule

def TupleXXL_fromIterator(using Context): Symbol = TupleXXLModule.requiredMethod("fromIterator")
def TupleXXL_unapplySeq(using Context): Symbol = TupleXXLModule.requiredMethod(nme.unapplySeq)

@tu lazy val RuntimeTupleMirrorTypeRef: TypeRef = requiredClassRef("scala.runtime.TupleMirror")

Expand Down
1 change: 1 addition & 0 deletions compiler/src/dotty/tools/dotc/transform/patmat/Space.scala
Original file line number Diff line number Diff line change
Expand Up @@ -838,6 +838,7 @@ object SpaceEngine {
val tpw = tp.widen.dealias
val classSym = tpw.classSymbol
classSym.is(Sealed) && !tpw.isLargeGenericTuple || // exclude large generic tuples from exhaustivity
// requires an unknown number of changes to make work
tpw.isInstanceOf[OrType] ||
(tpw.isInstanceOf[AndType] && {
val and = tpw.asInstanceOf[AndType]
Expand Down

0 comments on commit 42e8c0c

Please sign in to comment.