Skip to content

Commit 4b812e3

Browse files
committed
Align typer and rechecker for Labelled and Bind trees
There was a subtle difference which causeed the stdlib tests to crash under -Xprint:cc
1 parent 74696b9 commit 4b812e3

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

compiler/src/dotty/tools/dotc/core/Types.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3590,7 +3590,7 @@ object Types {
35903590

35913591
def expectValueTypeOrWildcard(tp: Type, where: => String)(using Context): Unit =
35923592
if !tp.isValueTypeOrWildcard then
3593-
assert(!ctx.isAfterTyper, where) // we check correct kinds at PostTyper
3593+
assert(!ctx.isAfterTyper, s"$tp in $where") // we check correct kinds at PostTyper
35943594
throw TypeError(em"$tp is not a value type, cannot be used $where")
35953595

35963596
/** An extractor object to pattern match against a nullable union.

compiler/src/dotty/tools/dotc/transform/Recheck.scala

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,14 +224,13 @@ abstract class Recheck extends Phase, SymTransformer:
224224
def recheckBind(tree: Bind, pt: Type)(using Context): Type = tree match
225225
case Bind(name, body) =>
226226
recheck(body, pt)
227-
val sym = tree.symbol
228-
if sym.isType then sym.typeRef else sym.info
227+
tree.symbol.namedType
229228

230229
def recheckLabeled(tree: Labeled, pt: Type)(using Context): Type = tree match
231230
case Labeled(bind, expr) =>
232-
val bindType = recheck(bind, pt)
231+
val (bindType: NamedType) = recheck(bind, pt): @unchecked
233232
val exprType = recheck(expr, defn.UnitType)
234-
bindType
233+
bindType.symbol.info
235234

236235
def recheckValDef(tree: ValDef, sym: Symbol)(using Context): Unit =
237236
if !tree.rhs.isEmpty then recheck(tree.rhs, sym.info)

0 commit comments

Comments
 (0)