File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed
compiler/src/dotty/tools/dotc/transform/init Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -1132,10 +1132,6 @@ object Semantic:
11321132 */
11331133 def tryPromote (msg : String ): Contextual [List [Error ]] = log(" promote " + warm.show + " , promoted = " + promoted, printer) {
11341134 val classRef = warm.klass.appliedRef
1135- val hasInnerClass = classRef.memberClasses.filter(_.symbol.hasSource).nonEmpty
1136- if hasInnerClass then
1137- return PromoteError (msg + " Promotion cancelled as the value contains inner classes." , trace.toVector) :: Nil
1138-
11391135 val obj = warm.objekt
11401136
11411137 def doPromote (klass : ClassSymbol , subClass : ClassSymbol , subClassSegmentHot : Boolean )(using Reporter ): Unit =
@@ -1160,7 +1156,10 @@ object Semantic:
11601156 // those methods are checked as part of the check for the class where they are defined.
11611157 if ! isHotSegment then
11621158 for member <- klass.info.decls do
1163- if ! member.isType && ! member.isConstructor && member.hasSource && ! member.is(Flags .Deferred ) then
1159+ if member.isClass then
1160+ val error = PromoteError (msg + " Promotion cancelled as the value contains inner classes." , trace.toVector)
1161+ reporter.report(error)
1162+ else if ! member.isType && ! member.isConstructor && ! member.is(Flags .Deferred ) then
11641163 given Trace = Trace .empty
11651164 if member.is(Flags .Method , butNot = Flags .Accessor ) then
11661165 val args = member.info.paramInfoss.flatten.map(_ => ArgInfo (Hot , Trace .empty))
Original file line number Diff line number Diff line change 1+ class ContextBase :
2+ class Inner :
3+ def foo (): ContextBase = ContextBase .this
4+
5+ class Outer :
6+ val ctx = new ContextBase {}
7+ println(ctx)
8+ val n = 10
You can’t perform that action at this time.
0 commit comments