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
This commit was created on GitHub.com and signed with GitHub’s verified signature.
Add literal syntax for `os.Path`, `os.SubPath`, `os.RelPath` (#353)
This PR allows
```scala
val p: os.Path = "/hello/world"
val s: os.SubPath = "hello/world"
val r: os.RelPath = "../hello/world"
```
This only allows string-literals that are valid
absolute/sub/relative-path respectively; passing in invalid paths (e.g.
`val p: os.Path = "hello/world"`) or non-literals (e.g. `val str =
"/hello/world"; val s: os.SubPath = str `) is a compile error
This builds upon @pawelsadlo's work in
https://github.com/com-lihaoyi/os-lib/pull/297, mostly using
`segmentsFromStringLiteralValidation` unchanged with some light pre/post
processing to trim the leading `/` off of absolute `os.Path`s and check
for leading `..`s on `os.SubPath`s
I'm going to declare bankruptcy on the Expecty issues, as we cannot
forever be working around bugs in unrelated libraries. If someone has
problems and wants to fix expecty, they can do so, and we don't need to
care. If nobody cares enough to fix expecty, we shouldn't care either.