File tree 1 file changed +8
-1
lines changed
compiler/src/dotty/tools/dotc/transform
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -335,7 +335,14 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisPhase
335
335
&& ctx.compilationUnit.source.exists
336
336
&& sym != defn.SourceFileAnnot
337
337
then
338
- sym.addAnnotation(Annotation .makeSourceFile(ctx.compilationUnit.source.file.path))
338
+ val jpath = ctx.compilationUnit.source.file.jpath.normalize
339
+ val sourceroot =
340
+ java.nio.file.Paths .get(ctx.settings.sourceroot.value)
341
+ .toAbsolutePath
342
+ .normalize
343
+ val relativePath =
344
+ if jpath.isAbsolute then sourceroot.relativize(jpath) else jpath
345
+ sym.addAnnotation(Annotation .makeSourceFile(relativePath.toString))
339
346
else (tree.rhs, sym.info) match
340
347
case (rhs : LambdaTypeTree , bounds : TypeBounds ) =>
341
348
VarianceChecker .checkLambda(rhs, bounds)
You can’t perform that action at this time.
0 commit comments