File tree 1 file changed +9
-1
lines changed
compiler/src/dotty/tools/dotc/util 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -233,7 +233,15 @@ object SourceFile {
233
233
// As we already check that the prefix matches, the special handling for
234
234
// Windows is not needed.
235
235
236
- refPath.relativize(sourcePath).toString
236
+ // We also consistently use forward slashes as path element separators
237
+ // for relative paths. If we didn't do that, it'd be impossible to parse
238
+ // them back, as one would need to know whether they were created on Windows
239
+ // and use both slashes as separators, or on other OS and use forward slash
240
+ // as separator, backslash as file name character.
241
+
242
+ import scala .jdk .CollectionConverters ._
243
+ val path = refPath.relativize(sourcePath)
244
+ path.iterator.asScala.mkString(" /" )
237
245
else
238
246
sourcePath.toString
239
247
}
You can’t perform that action at this time.
0 commit comments