File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
compiler/src/dotty/tools/dotc/transform Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -343,7 +343,12 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisPhase
343343 val jpath = file.jpath
344344 val relativePath =
345345 if jpath eq null then file.path // repl and other custom tests use abstract files with no path
346- else if jpath.isAbsolute then sourcerootPath.relativize(jpath.normalize).toString
346+ else if jpath.isAbsolute then
347+ val cunitPath = jpath.normalize
348+ // On Windows we can only relativize paths if root component matches
349+ // (see implementation of sun.nio.fs.WindowsPath#relativize)
350+ try sourcerootPath.relativize(cunitPath).toString
351+ catch case _ : IllegalArgumentException => cunitPath.toString
347352 else jpath.normalize.toString
348353 sym.addAnnotation(Annotation .makeSourceFile(relativePath))
349354 else (tree.rhs, sym.info) match
You can’t perform that action at this time.
0 commit comments