From 3a77dd71904c332f1812ecf1a243f67e1f85ec6d Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Wed, 13 Nov 2024 10:49:18 +0100 Subject: [PATCH 1/4] Fix expected name of output filename on Windows in TraceNameManglingTest --- .../test/dotty/tools/dotc/profile/TraceNameManglingTest.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/test/dotty/tools/dotc/profile/TraceNameManglingTest.scala b/compiler/test/dotty/tools/dotc/profile/TraceNameManglingTest.scala index 977b67740f88..216bc31d4315 100644 --- a/compiler/test/dotty/tools/dotc/profile/TraceNameManglingTest.scala +++ b/compiler/test/dotty/tools/dotc/profile/TraceNameManglingTest.scala @@ -46,7 +46,7 @@ class TraceNameManglingTest extends DottyTest { raw"setter /\\_=" ).map(TraceEvent("typecheck", _)) ++ Set( - TraceEvent("file", if isWindows then "/.scala" else "\\\\.scala") + TraceEvent("file", if isWindows then ".scala" else "\\\\.scala") ) ) } From de4d41db6beb2bf090874827db01531e61f0e092 Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Wed, 13 Nov 2024 18:42:51 +0100 Subject: [PATCH 2/4] Fix checking for windows os in TraceNameManglingtEst --- .../test/dotty/tools/dotc/profile/TraceNameManglingTest.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/test/dotty/tools/dotc/profile/TraceNameManglingTest.scala b/compiler/test/dotty/tools/dotc/profile/TraceNameManglingTest.scala index 216bc31d4315..1fbd1881b844 100644 --- a/compiler/test/dotty/tools/dotc/profile/TraceNameManglingTest.scala +++ b/compiler/test/dotty/tools/dotc/profile/TraceNameManglingTest.scala @@ -27,7 +27,7 @@ class TraceNameManglingTest extends DottyTest { } @Test def escapeBackslashes(): Unit = { - val isWindows = sys.props("os.name").toLowerCase(Locale.ROOT) == "windows" + val isWindows = sys.props("os.name").toLowerCase(Locale.ROOT).contains("windows") val filename = if isWindows then "/.scala" else "\\.scala" checkTraceEvents( """ @@ -46,7 +46,7 @@ class TraceNameManglingTest extends DottyTest { raw"setter /\\_=" ).map(TraceEvent("typecheck", _)) ++ Set( - TraceEvent("file", if isWindows then ".scala" else "\\\\.scala") + TraceEvent("file", if isWindows then "/.scala" else "\\\\.scala") ) ) } From d26d87f9fbae0312adf37750482ea8684d46df95 Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Wed, 13 Nov 2024 18:59:53 +0100 Subject: [PATCH 3/4] Fix compilation under -Yexplicit-nulls --- .../test/dotty/tools/dotc/profile/TraceNameManglingTest.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/test/dotty/tools/dotc/profile/TraceNameManglingTest.scala b/compiler/test/dotty/tools/dotc/profile/TraceNameManglingTest.scala index 1fbd1881b844..b0a4e0e2140f 100644 --- a/compiler/test/dotty/tools/dotc/profile/TraceNameManglingTest.scala +++ b/compiler/test/dotty/tools/dotc/profile/TraceNameManglingTest.scala @@ -27,7 +27,7 @@ class TraceNameManglingTest extends DottyTest { } @Test def escapeBackslashes(): Unit = { - val isWindows = sys.props("os.name").toLowerCase(Locale.ROOT).contains("windows") + val isWindows = sys.props("os.name").toLowerCase(Locale.ROOT).nn.contains("windows") val filename = if isWindows then "/.scala" else "\\.scala" checkTraceEvents( """ From cf6018af07453447076c80e4ac9f6e73f3fe1021 Mon Sep 17 00:00:00 2001 From: Wojciech Mazur Date: Wed, 13 Nov 2024 21:58:57 +0100 Subject: [PATCH 4/4] Acknowledge that filename with backslash cannot be created on Windows --- .../dotty/tools/dotc/profile/TraceNameManglingTest.scala | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/compiler/test/dotty/tools/dotc/profile/TraceNameManglingTest.scala b/compiler/test/dotty/tools/dotc/profile/TraceNameManglingTest.scala index b0a4e0e2140f..f1f570cc85d4 100644 --- a/compiler/test/dotty/tools/dotc/profile/TraceNameManglingTest.scala +++ b/compiler/test/dotty/tools/dotc/profile/TraceNameManglingTest.scala @@ -28,7 +28,8 @@ class TraceNameManglingTest extends DottyTest { @Test def escapeBackslashes(): Unit = { val isWindows = sys.props("os.name").toLowerCase(Locale.ROOT).nn.contains("windows") - val filename = if isWindows then "/.scala" else "\\.scala" + // It is not possible to create a file with backslash in name on Windows + val filename = if isWindows then "test.scala" else "\\.scala" checkTraceEvents( """ |class /\ : @@ -46,7 +47,8 @@ class TraceNameManglingTest extends DottyTest { raw"setter /\\_=" ).map(TraceEvent("typecheck", _)) ++ Set( - TraceEvent("file", if isWindows then "/.scala" else "\\\\.scala") + // See comment aboce for Windows limitations + TraceEvent("file", if isWindows then filename else "\\\\.scala") ) ) }