From 87b1aff1927e5c99a46fc39ffacbade6d3457393 Mon Sep 17 00:00:00 2001 From: Geod24 Date: Tue, 28 Jul 2020 09:46:30 +0900 Subject: [PATCH] [TEST ONLY] Enable `preview=in` by default --- compiler/src/dmd/globals.d | 2 +- compiler/test/fail_compilation/deprecatedinref.d | 4 ++-- compiler/test/fail_compilation/deprecations_preview_in.d | 2 +- compiler/test/fail_compilation/fail183.d | 8 ++++---- compiler/test/run.d | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/compiler/src/dmd/globals.d b/compiler/src/dmd/globals.d index fde1667556c4..7d447092855d 100644 --- a/compiler/src/dmd/globals.d +++ b/compiler/src/dmd/globals.d @@ -162,7 +162,7 @@ extern (C++) struct Param // https://digitalmars.com/d/archives/digitalmars/D/Binding_rvalues_to_ref_parameters_redux_325087.html // Implementation: https://github.com/dlang/dmd/pull/9817 FeatureState noSharedAccess; // read/write access to shared memory objects - bool previewIn; // `in` means `[ref] scope const`, accepts rvalues + bool previewIn = true; // `in` means `[ref] scope const`, accepts rvalues bool inclusiveInContracts; // 'in' contracts of overridden methods must be a superset of parent contract bool shortenedMethods = true; // allow => in normal function declarations bool fixImmutableConv; // error on unsound immutable conversion - https://github.com/dlang/dmd/pull/14070 diff --git a/compiler/test/fail_compilation/deprecatedinref.d b/compiler/test/fail_compilation/deprecatedinref.d index 20c3666bef1e..b3a374a5e66c 100644 --- a/compiler/test/fail_compilation/deprecatedinref.d +++ b/compiler/test/fail_compilation/deprecatedinref.d @@ -2,8 +2,8 @@ REQUIRED_ARGS: -de TEST_OUTPUT: --- -fail_compilation/deprecatedinref.d(9): Deprecation: using `in ref` is deprecated, use `-preview=in` and `in` instead -fail_compilation/deprecatedinref.d(10): Deprecation: using `ref in` is deprecated, use `-preview=in` and `in` instead +fail_compilation/deprecatedinref.d(9): Error: attribute `ref` is redundant with previously-applied `in` +fail_compilation/deprecatedinref.d(10): Error: attribute `in` cannot be added after `ref`: remove `ref` --- */ void foo(in ref int); diff --git a/compiler/test/fail_compilation/deprecations_preview_in.d b/compiler/test/fail_compilation/deprecations_preview_in.d index 33cc904e4bec..ed7d7d348e35 100644 --- a/compiler/test/fail_compilation/deprecations_preview_in.d +++ b/compiler/test/fail_compilation/deprecations_preview_in.d @@ -2,7 +2,7 @@ REQUIRED_ARGS: -de TEST_OUTPUT: --- -fail_compilation/deprecations_preview_in.d(1): Deprecation: using `in` parameters with `extern(C)` functions is deprecated +fail_compilation/deprecations_preview_in.d(1): Error: cannot use `in` parameters with `extern(C)` functions fail_compilation/deprecations_preview_in.d(1): parameter `__anonymous_param` declared as `in` here --- */ diff --git a/compiler/test/fail_compilation/fail183.d b/compiler/test/fail_compilation/fail183.d index 362213c1f640..b086893bf416 100644 --- a/compiler/test/fail_compilation/fail183.d +++ b/compiler/test/fail_compilation/fail183.d @@ -2,13 +2,13 @@ TEST_OUTPUT: --- fail_compilation/fail183.d(17): Error: attribute `const` is redundant with previously-applied `in` -fail_compilation/fail183.d(18): Error: attribute `scope` cannot be applied with `in`, use `-preview=in` instead +fail_compilation/fail183.d(18): Error: attribute `scope` is redundant with previously-applied `in` fail_compilation/fail183.d(19): Error: attribute `const` is redundant with previously-applied `in` -fail_compilation/fail183.d(19): Error: attribute `scope` cannot be applied with `in`, use `-preview=in` instead -fail_compilation/fail183.d(20): Error: attribute `scope` cannot be applied with `in`, use `-preview=in` instead +fail_compilation/fail183.d(19): Error: attribute `scope` is redundant with previously-applied `in` +fail_compilation/fail183.d(20): Error: attribute `scope` is redundant with previously-applied `in` fail_compilation/fail183.d(20): Error: attribute `const` is redundant with previously-applied `in` fail_compilation/fail183.d(22): Error: attribute `in` cannot be added after `const`: remove `const` -fail_compilation/fail183.d(23): Error: attribute `in` cannot be added after `scope`: remove `scope` and use `-preview=in` +fail_compilation/fail183.d(23): Error: attribute `in` cannot be added after `scope`: remove `scope` fail_compilation/fail183.d(24): Error: attribute `in` cannot be added after `const`: remove `const` fail_compilation/fail183.d(25): Error: attribute `in` cannot be added after `const`: remove `const` --- diff --git a/compiler/test/run.d b/compiler/test/run.d index 3d1ddf883fbd..7510c1e2bbb2 100755 --- a/compiler/test/run.d +++ b/compiler/test/run.d @@ -158,7 +158,7 @@ Options: args = ["all"]; // move any long-running tests to the front - static size_t sortKey(in ref Target target) + static size_t sortKey(const scope ref Target target) { const name = target.normalizedTestName; if (name.startsWith("runnable"))