File tree Expand file tree Collapse file tree 3 files changed +24
-1
lines changed
compiler/src/dotty/tools/dotc/transform/init Expand file tree Collapse file tree 3 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -1157,7 +1157,7 @@ object Semantic:
1157
1157
if ! isHotSegment then
1158
1158
for member <- klass.info.decls do
1159
1159
if member.isClass then
1160
- val error = PromoteError (msg + " Promotion cancelled as the value contains inner classes. " , trace.toVector )
1160
+ val error = PromoteError (" Promotion cancelled as the value contains inner " + member.show + " . " , Vector .empty )
1161
1161
reporter.report(error)
1162
1162
else if ! member.isType && ! member.isConstructor && ! member.is(Flags .Deferred ) then
1163
1163
given Trace = Trace .empty
Original file line number Diff line number Diff line change
1
+ -- Error: tests/init/neg/promotion-segment3.scala:9:6 ------------------------------------------------------------------
2
+ 9 | bar(new B) // error
3
+ | ^^^^^
4
+ | Cannot prove the method argument is hot. Only hot values are safe to leak.
5
+ | Found = Warm[class B] { outer = ThisRef[class A] }. Calling trace:
6
+ | -> class A: [ promotion-segment3.scala:2 ]
7
+ | ^
8
+ | -> bar(new B) // error [ promotion-segment3.scala:9 ]
9
+ | ^^^^^
10
+ |
11
+ | Promoting the value to hot failed due to the following problem:
12
+ | Promotion cancelled as the value contains inner class C.
Original file line number Diff line number Diff line change
1
+
2
+ class A :
3
+ class B :
4
+ class C :
5
+ def foo (): Int = m
6
+
7
+ def bar (b : B ) = new b.C ().foo()
8
+
9
+ bar(new B ) // error
10
+
11
+ val m = 10
You can’t perform that action at this time.
0 commit comments