From a3c1968acdcca1150e156d4a0f1021e51ee6232e 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/fail183.d | 8 ++++---- compiler/test/run.d | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/compiler/src/dmd/globals.d b/compiler/src/dmd/globals.d index 1919d9ae0ce1..a828b9c79e59 100644 --- a/compiler/src/dmd/globals.d +++ b/compiler/src/dmd/globals.d @@ -157,7 +157,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/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"))