Skip to content

Commit a6578f8

Browse files
committed
Enforce that only initialized values may be returned
1 parent c4aa9ac commit a6578f8

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

compiler/src/dotty/tools/dotc/transform/init/Summarization.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,8 @@ object Summarization {
146146
// Summary.empty
147147

148148
case Return(expr, from) =>
149-
// TODO: return potential to the method
150149
val (pots, effs) = analyze(expr)
151-
(Potentials.empty, effs)
150+
(Potentials.empty, effs ++ pots.promote(expr))
152151

153152
case WhileDo(cond, body) =>
154153
// for lazy fields, the translation may result im `while (<empty>)`

0 commit comments

Comments
 (0)