@@ -137,18 +137,20 @@ object Feature:
137
137
report.error(em " Experimental $which may only be used with a nightly or snapshot version of the compiler $note" , srcPos)
138
138
139
139
private def ccException (sym : Symbol )(using Context ): Boolean =
140
- ccEnabled && defn.ccExperimental.contains(sym)
140
+ ccEnabled && defn.ccExperimental.contains(sym)
141
141
142
142
def checkExperimentalDef (sym : Symbol , srcPos : SrcPos )(using Context ) =
143
- if ! isExperimentalEnabled && ! ccException(sym) then
144
- val symMsg =
145
- if sym.hasAnnotation(defn.ExperimentalAnnot ) then
146
- i " $sym is marked @experimental "
147
- else if sym.owner.hasAnnotation(defn.ExperimentalAnnot ) then
148
- i " ${sym.owner} is marked @experimental "
149
- else
150
- i " $sym inherits @experimental "
151
- report.error(em " $symMsg and therefore may only be used in an experimental scope. " , srcPos)
143
+ if ! isExperimentalEnabled then
144
+ val experimentalSym =
145
+ if sym.hasAnnotation(defn.ExperimentalAnnot ) then sym
146
+ else if sym.owner.hasAnnotation(defn.ExperimentalAnnot ) then sym.owner
147
+ else NoSymbol
148
+ if ! ccException(experimentalSym) then
149
+ val symMsg =
150
+ if experimentalSym.exists
151
+ then i " $experimentalSym is marked @experimental "
152
+ else i " $sym inherits @experimental "
153
+ report.error(em " $symMsg and therefore may only be used in an experimental scope. " , srcPos)
152
154
153
155
/** Check that experimental compiler options are only set for snapshot or nightly compiler versions. */
154
156
def checkExperimentalSettings (using Context ): Unit =
0 commit comments