When using `absolutePath` with 'priview=in' enabled,
it requires to duplicate value to be able to call this function.
Within this commit the signature of `absolutePath` function
is changed from `string absolutePath(string path, lazy string base = getcwd())`
to `string absolutePath(return scope const string path, lazy string base = getcwd())`
thus, after this commit it is possible to use this func in scope context.
Example case:
```d
/+ dub.sdl:
name "dub-example"
dflags "-preview=in" "-preview=dip1000"
+/
import std.stdio;
import std.path;
@safe:
string fun(in string path) {
return path.absolutePath;
}
void main() {
string p = fun("~/tests/1");
writefln("P: %s", p);
}
```
* typecons: fix use-after-scope bug in RefCounted unittest
The access through `p` to `rc1` outside the scope of `rc1` is undefined behavior. We have to artificially end the scope of `rc1` and `rc2`, such that within the same scope we can check that the destructor calls do the correct thing of nulling the `_store`.
* fixup
* fixup
When using `expandTilde` with 'priview=in' enabled,
it requires to duplicate value to be able to call this function.
Within this commit the signature of expandTilde function is
changed from `string expandTilde(string inputPath) @safe nothrow`
to `string expandTilde(return scope const string inputPath) @safe nothrow`
thus, after this commit it is possible to use this func in scope
context.
Example case:
```d
/+ dub.sdl:
name "dub-example"
dflags "-preview=in" "-preview=dip1000"
+/
import std.stdio;
import std.path;
@safe:
string fun(in string path) {
return path.expandTilde;
}
void main() {
string p = fun("~/tests/1");
writefln("P: %s", p);
}
```
`only` is a range that may be *mutable*, but not *assignable*. `chain` falls over here because it assumes it can make a struct with ranges, and reassign them with new values, which isn't necessarily the case even if the ranges are not `const`.
Solved by creating a separate tuple of `Rebindable` ranges for this case.
* Fix cstdio links
Fixes Issue 23834 - std.file : File links to c functions are invalid and
need updating
* Fix whitespace
* No need for prefix underscore
* Fix issue 22785: `joiner` should `Unqual` child ranges.
This allows use with `immutable T[][]` and similar.
---------
Co-authored-by: Petar Kirov <petar.p.kirov@gmail.com>
* Optimised std.range.chain
Chain now remembers which subrange has the first and the last elements,
eliminating needless work on each usage.
* Style fix.
* No longer needless `.empty` calls in the constructor.
* Improvements based on Razvans observations.