File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed
compiler/src/dotty/tools/dotc/core
tests/neg-custom-args/captures Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -788,7 +788,10 @@ object SymDenotations {
788788 * So the first call to a stable member might fail and/or produce side effects.
789789 */
790790 final def isStableMember (using Context ): Boolean = {
791- def isUnstableValue = isOneOf(UnstableValueFlags ) || isAllOf(InlineParam )
791+ def isUnstableValue =
792+ isOneOf(UnstableValueFlags )
793+ || ! ctx.mode.is(Mode .InCaptureSet ) && info.isInstanceOf [ExprType ]
794+ || isAllOf(InlineParam )
792795 isType || is(StableRealizable ) || exists && ! isUnstableValue
793796 }
794797
Original file line number Diff line number Diff line change @@ -6,6 +6,6 @@ object foo
66
77def test (c : Cap , other : String ): Unit =
88 val x7 : String ^ {c} = ??? // OK
9- val x8 : String @ retains[(x7 + x7) ] = ??? // error
9+ val x8 : String @ retains[" " ] = ??? // error
1010 val x9 : String @ retains[foo] = ??? // error
1111 ()
You can’t perform that action at this time.
0 commit comments