Skip to content

Commit 2849052

Browse files
committed
Add note for tempting but unsound optimization
1 parent 2589824 commit 2849052

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,14 @@ object Semantic {
304304
this.changed = true
305305
last.put(value, expr, actual.value)
306306
current.put(value, expr, actual.value)
307+
else
308+
// It's tempting to cache the value in stable, but it's unsound.
309+
// The reason is that the current value may depend on other values
310+
// which might change.
311+
//
312+
// stable.put(value, expr, actual)
313+
()
314+
end if
307315

308316
actual
309317

0 commit comments

Comments
 (0)