File tree Expand file tree Collapse file tree 3 files changed +16
-7
lines changed
compiler/src/dotty/tools/dotc
library/src/scala/annotation/internal Expand file tree Collapse file tree 3 files changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -923,6 +923,7 @@ class Definitions {
923923 @ tu lazy val BooleanBeanPropertyAnnot : ClassSymbol = requiredClass(" scala.beans.BooleanBeanProperty" )
924924 @ tu lazy val BodyAnnot : ClassSymbol = requiredClass(" scala.annotation.internal.Body" )
925925 @ tu lazy val CapabilityAnnot : ClassSymbol = requiredClass(" scala.annotation.capability" )
926+ @ tu lazy val CaptureCheckedAnnot : ClassSymbol = requiredClass(" scala.annotation.internal.CaptureChecked" )
926927 @ tu lazy val ChildAnnot : ClassSymbol = requiredClass(" scala.annotation.internal.Child" )
927928 @ tu lazy val ContextResultCountAnnot : ClassSymbol = requiredClass(" scala.annotation.internal.ContextResultCount" )
928929 @ tu lazy val ProvisionalSuperClassAnnot : ClassSymbol = requiredClass(" scala.annotation.internal.ProvisionalSuperClass" )
Original file line number Diff line number Diff line change @@ -372,13 +372,13 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisPhase
372372 for parent <- impl.parents do
373373 Checking .checkTraitInheritance(parent.tpe.classSymbol, sym.asClass, parent.srcPos)
374374 // Add SourceFile annotation to top-level classes
375- if sym.owner.is(Package )
376- && ctx.compilationUnit.source.exists
377- && sym != defn. SourceFileAnnot
378- then
379- val reference = ctx.settings.sourceroot.value
380- val relativePath = util. SourceFile .relativePath(ctx.compilationUnit.source, reference)
381- sym.addAnnotation(Annotation .makeSourceFile(relativePath ))
375+ if sym.owner.is(Package ) then
376+ if ctx.compilationUnit.source.exists && sym != defn. SourceFileAnnot then
377+ val reference = ctx.settings.sourceroot.value
378+ val relativePath = util. SourceFile .relativePath(ctx.compilationUnit.source, reference)
379+ sym.addAnnotation( Annotation .makeSourceFile(relativePath))
380+ if ctx.settings. Ycc .value && sym != defn. CaptureCheckedAnnot then
381+ sym.addAnnotation(Annotation (defn. CaptureCheckedAnnot ))
382382 else (tree.rhs, sym.info) match
383383 case (rhs : LambdaTypeTree , bounds : TypeBounds ) =>
384384 VarianceChecker .checkLambda(rhs, bounds)
Original file line number Diff line number Diff line change 1+ package scala .annotation
2+ package internal
3+
4+ /** A marker annotation on a toplevel class that indicates
5+ * that the class was checked under -Ycc
6+ */
7+ class CaptureChecked extends StaticAnnotation
8+
You can’t perform that action at this time.
0 commit comments