aboutsummaryrefslogtreecommitdiff
path: root/libphobos/src/std/path.d
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2023-07-10 03:07:41 +0200
committerIain Buclaw <ibuclaw@gdcproject.org>2023-07-10 03:13:00 +0200
commit0cafc3b6272d1dd738e8d7e66e1d8741e08f74d3 (patch)
tree8c549ddd4b93c78f44959d47a4956837022a5cf1 /libphobos/src/std/path.d
parentd41a57c46df6f8f7dae0c0a8b349e734806a837b (diff)
downloadgcc-0cafc3b6272d1dd738e8d7e66e1d8741e08f74d3.zip
gcc-0cafc3b6272d1dd738e8d7e66e1d8741e08f74d3.tar.gz
gcc-0cafc3b6272d1dd738e8d7e66e1d8741e08f74d3.tar.bz2
d: Merge upstream dmd, druntime 17ccd12af3, phobos 8d3800bee.
D front-end changes: - Import dmd v2.104.0. - Assignment-style syntax is now allowed for `alias this'. - Overloading `extern(C)' functions is now an error. D runtime changes: - Import druntime v2.104.0. Phobos changes: - Import phobos v2.104.0. - Better static assert messages when instantiating `std.algorithm.iteration.permutations' with wrong inputs. - Added `std.system.instructionSetArchitecture' and `std.system.ISA'. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 17ccd12af3. * dmd/VERSION: Bump version to v2.104.0. * Make-lang.in (D_FRONTEND_OBJS): Rename d/apply.o to d/postordervisitor.o. * d-codegen.cc (make_location_t): Update for new front-end interface. (build_filename_from_loc): Likewise. (build_assert_call): Likewise. (build_array_bounds_call): Likewise. (build_bounds_index_condition): Likewise. (build_bounds_slice_condition): Likewise. (build_frame_type): Likewise. (get_frameinfo): Likewise. * d-diagnostic.cc (d_diagnostic_report_diagnostic): Likewise. * decl.cc (build_decl_tree): Likewise. (start_function): Likewise. * expr.cc (ExprVisitor::visit (NewExp *)): Replace code generation of `new pointer' with front-end lowering. * runtime.def (NEWITEMT): Remove. (NEWITEMIT): Remove. * toir.cc (IRVisitor::visit (LabelStatement *)): Update for new front-end interface. * typeinfo.cc (check_typeinfo_type): Likewise. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime 17ccd12af3. * src/MERGE: Merge upstream phobos 8d3800bee. gcc/testsuite/ChangeLog: * gdc.dg/asm4.d: Update test.
Diffstat (limited to 'libphobos/src/std/path.d')
-rw-r--r--libphobos/src/std/path.d26
1 files changed, 23 insertions, 3 deletions
diff --git a/libphobos/src/std/path.d b/libphobos/src/std/path.d
index 63d60d1..e81f2b6 100644
--- a/libphobos/src/std/path.d
+++ b/libphobos/src/std/path.d
@@ -3955,7 +3955,7 @@ if (isConvertibleToString!Range)
}
-----
*/
-string expandTilde(string inputPath) @safe nothrow
+string expandTilde(return scope const string inputPath) @safe nothrow
{
version (Posix)
{
@@ -4138,7 +4138,7 @@ string expandTilde(string inputPath) @safe nothrow
}
///
-@system unittest
+@safe unittest
{
version (Posix)
{
@@ -4153,7 +4153,7 @@ string expandTilde(string inputPath) @safe nothrow
}
}
-@system unittest
+@safe unittest
{
version (Posix)
{
@@ -4205,6 +4205,26 @@ string expandTilde(string inputPath) @safe nothrow
}
}
+@safe unittest
+{
+ version (Posix)
+ {
+ import std.process : environment;
+
+ string testPath(scope const string source_path) {
+ return source_path.expandTilde;
+ }
+
+ auto oldHome = environment["HOME"];
+ scope(exit) environment["HOME"] = oldHome;
+
+ environment["HOME"] = "dmd/test";
+ assert(testPath("~/") == "dmd/test/");
+ assert(testPath("~") == "dmd/test");
+ }
+}
+
+
version (StdUnittest)
{
private: