Skip to content

Commit

Permalink
Align rechecking ValDefs and DefDefs
Browse files Browse the repository at this point in the history
Makes things more regular and allows for a
non-identity mapping between declared types and infos of vals.
  • Loading branch information
odersky committed Sep 20, 2023
1 parent c31c24d commit 66546df
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions compiler/src/dotty/tools/dotc/transform/Recheck.scala
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,9 @@ abstract class Recheck extends Phase, SymTransformer:
bindType.symbol.info

def recheckValDef(tree: ValDef, sym: Symbol)(using Context): Type =
if tree.rhs.isEmpty then sym.info
else recheck(tree.rhs, sym.info)
val resType = recheck(tree.tpt)
if tree.rhs.isEmpty then resType
else recheck(tree.rhs, resType)

def recheckDefDef(tree: DefDef, sym: Symbol)(using Context): Type =
inContext(linkConstructorParams(sym).withOwner(sym)):
Expand Down

0 comments on commit 66546df

Please sign in to comment.