Skip to content

Commit

Permalink
Do not add @SourceFile annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasstucki committed Nov 27, 2023
1 parent 9b8ab6e commit 9e01840
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 6 deletions.
2 changes: 0 additions & 2 deletions compiler/src/dotty/tools/dotc/core/Annotations.scala
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,6 @@ object Annotations {
else None
}

def makeSourceFile(path: String, span: Span)(using Context): Annotation =
apply(defn.SourceFileAnnot, Literal(Constant(path)), span)
}

@sharable val EmptyAnnotation = Annotation(EmptyTree)
Expand Down
4 changes: 0 additions & 4 deletions compiler/src/dotty/tools/dotc/transform/PostTyper.scala
Original file line number Diff line number Diff line change
Expand Up @@ -419,10 +419,6 @@ class PostTyper extends MacroTransform with InfoTransformer { thisPhase =>
em"The type of a class parent cannot refer to constructor parameters, but ${parent.tpe} refers to ${illegalRefs.map(_.name.show).mkString(",")}", parent.srcPos)
// Add SourceFile annotation to top-level classes
if sym.owner.is(Package) then
if ctx.compilationUnit.source.exists && sym != defn.SourceFileAnnot then
val reference = ctx.settings.sourceroot.value
val relativePath = util.SourceFile.relativePath(ctx.compilationUnit.source, reference)
sym.addAnnotation(Annotation.makeSourceFile(relativePath, tree.span))
if sym != defn.WithPureFunsAnnot && sym != defn.CaptureCheckedAnnot then
if Feature.ccEnabled then
sym.addAnnotation(Annotation(defn.CaptureCheckedAnnot, tree.span))
Expand Down

0 comments on commit 9e01840

Please sign in to comment.