We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ab1d592 commit 16c899dCopy full SHA for 16c899d
compiler/src/dotty/tools/dotc/util/SourceFile.scala
@@ -220,7 +220,11 @@ object SourceFile {
220
if jpath eq null then
221
file.path // repl and other custom tests use abstract files with no path
222
else
223
- sourcerootPath.relativize(jpath.toAbsolutePath.normalize).toString
+ val normalizedPath = jpath.normalize
224
+ // On Windows we can only relativize paths if root component matches
225
+ // (see implementation of sun.nio.fs.WindowsPath#relativize)
226
+ try sourcerootPath.relativize(normalizedPath).toString
227
+ catch case _: IllegalArgumentException => normalizedPath.toString
228
}
229
230
0 commit comments