You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The previous implementation wrongly assumed that if
`jpath.normalize.getParent` returns null, then `jpath` must be a root.
However the null in this case really only means that no name elements
remain after normalization and the call to `getParent`. Since redundant
name elements such as "." and ".." may be removed by `normalize`, and
`getParent` may simply remove the last name element, there are cases
other than roots to consider, such as the current directory.
Some examples of broken behavior prior this commit:
scala> Path("./foo.txt").parent
val res0: dotty.tools.io.Directory = ./foo.txt // should be Directory(.)
scala> Path("foo.txt").parent
val res1: dotty.tools.io.Directory = foo.txt // should be Directory(.)
scala> Path(".").parent
val res4: dotty.tools.io.Directory = . // should be Directory(..)
The changes here are based in part on the Scala 2.13 implementation of
scala.reflect.io.Path#parent
Fixesscala#11644
0 commit comments