From 2cbe7bddf8cce3009b984ff38ce704999821a93e Mon Sep 17 00:00:00 2001 From: Chris Kipp Date: Thu, 4 May 2023 11:02:20 +0200 Subject: [PATCH] test: add in a check file for rewrite issue This adds in a test to ensure that the issue reported in #17399 is indeed fixed with #12954. This case is a bit different, so best to also just have it covered with a test. Closes #17399 --- compiler/test/dotty/tools/dotc/CompilationTests.scala | 1 + tests/rewrites/i17399.check | 7 +++++++ tests/rewrites/i17399.scala | 5 +++++ 3 files changed, 13 insertions(+) create mode 100644 tests/rewrites/i17399.check create mode 100644 tests/rewrites/i17399.scala diff --git a/compiler/test/dotty/tools/dotc/CompilationTests.scala b/compiler/test/dotty/tools/dotc/CompilationTests.scala index d75afc330f5f..c782c78f8eb7 100644 --- a/compiler/test/dotty/tools/dotc/CompilationTests.scala +++ b/compiler/test/dotty/tools/dotc/CompilationTests.scala @@ -82,6 +82,7 @@ class CompilationTests { compileFile("tests/rewrites/i11895.scala", defaultOptions.and("-indent", "-rewrite")), compileFile("tests/rewrites/i12340.scala", unindentOptions.and("-rewrite")), compileFile("tests/rewrites/i17187.scala", unindentOptions.and("-rewrite")), + compileFile("tests/rewrites/i17399.scala", unindentOptions.and("-rewrite")), ).checkRewrites() } diff --git a/tests/rewrites/i17399.check b/tests/rewrites/i17399.check new file mode 100644 index 000000000000..0b7eef78db4f --- /dev/null +++ b/tests/rewrites/i17399.check @@ -0,0 +1,7 @@ +def test[T](body:T):T = body + +object Test { + test { + println("test 1") + } +} diff --git a/tests/rewrites/i17399.scala b/tests/rewrites/i17399.scala new file mode 100644 index 000000000000..965d17c4f718 --- /dev/null +++ b/tests/rewrites/i17399.scala @@ -0,0 +1,5 @@ +def test[T](body:T):T = body + +object Test: + test: + println("test 1")