Skip to content

Commit 76d9d58

Browse files
committed
Fail when trying to add new elements to mapped sets
It's the safe option.
1 parent ac2dcc0 commit 76d9d58

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

compiler/src/dotty/tools/dotc/cc/CaptureSet.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,8 @@ object CaptureSet:
358358
mapRefs(newElems, tm, variance)
359359
else
360360
if variance <= 0 && !origin.isConst && (origin ne initial) then
361-
report.warning(i"trying to add elems $newElems to $this from unrecognized source of mapped set $this$whereCreated")
361+
report.warning(i"trying to add elems $newElems from unrecognized source $origin of mapped set $this$whereCreated")
362+
return CompareResult.fail(this)
362363
Const(newElems)
363364
val result = super.addNewElems(added.elems, origin)
364365
if result == CompareResult.OK then

0 commit comments

Comments
 (0)