From 0cafc3b6272d1dd738e8d7e66e1d8741e08f74d3 Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Mon, 10 Jul 2023 03:07:41 +0200 Subject: 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. --- libphobos/src/std/path.d | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'libphobos/src/std/path.d') 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: -- cgit v1.1