Skip to content

Commit 8c70a60

Browse files
lrhncommit-bot@chromium.org
authored andcommitted
Add tests for inconsistent language markers in part files.
Change-Id: Ife3f8145d146b3f406c1fdcaf77d91efda7e79d1 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154462 Reviewed-by: Johnni Winther <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Lasse R.H. Nielsen <[email protected]>
1 parent 37c8c70 commit 8c70a60

14 files changed

+174
-0
lines changed

.dart_tool/package_config.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,12 @@
353353
"packageUri": "lib/",
354354
"languageVersion": "2.2"
355355
},
356+
{
357+
"name": "language_versioning_2.7_test",
358+
"rootUri": "../pkg/language_versioning_2.7_test",
359+
"packageUri": "lib/",
360+
"languageVersion": "2.7"
361+
},
356362
{
357363
"name": "linter",
358364
"rootUri": "../third_party/pkg/linter",
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: language_versioning_2.7_test
2+
version: 1.0.0
3+
4+
description: >
5+
Tests of language versioning.
6+
Stored as a package in order to have its own package configuration
7+
and default language version
8+
9+
# This package is not intended for consumption on pub.dev. DO NOT publish.
10+
publish_to: none
11+
12+
environment:
13+
sdk: '>=2.7.0 <3.0.0'
14+
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS
2+
// file for details. All rights reserved. Use of this source code is
3+
// governed by a BSD-style license that can be found in the LICENSE file.
4+
5+
// Explicit version.
6+
// @dart=2.7
7+
8+
part "src/part_of_ex2.7_v_ex2.7.dart";
9+
10+
// Specification requires the part file to have
11+
// the same explicit langauge version marker
12+
// as the including library,
13+
// not just the same languge version.
14+
part "src/part_of_ex2.7_v_im2.7.dart";
15+
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
16+
// [analyzer] COMPILE_TIME_ERROR.INCONSISTENT_LANGUAGE_VERSION_OVERRIDE
17+
// [cfe] The language version override has to be the same in the library and its part(s).
18+
19+
part "src/part_of_ex2.7_v_ex2.8.dart";
20+
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
21+
// [analyzer] COMPILE_TIME_ERROR.INCONSISTENT_LANGUAGE_VERSION_OVERRIDE
22+
// [cfe] The language version override has to be the same in the library and its part(s).
23+
24+
main() {
25+
print(x27x27);
26+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS
2+
// file for details. All rights reserved. Use of this source code is
3+
// governed by a BSD-style license that can be found in the LICENSE file.
4+
5+
// Explicit version.
6+
// @dart=2.8
7+
8+
part "src/part_of_ex2.8_v_ex2.8.dart";
9+
10+
part "src/part_of_ex2.8_v_ex2.7.dart";
11+
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12+
// [analyzer] COMPILE_TIME_ERROR.INCONSISTENT_LANGUAGE_VERSION_OVERRIDE
13+
// [cfe] The language version override has to be the same in the library and its part(s).
14+
15+
part "src/part_of_ex2.8_v_im2.7.dart";
16+
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17+
// [analyzer] COMPILE_TIME_ERROR.INCONSISTENT_LANGUAGE_VERSION_OVERRIDE
18+
// [cfe] The language version override has to be the same in the library and its part(s).
19+
20+
void main() {
21+
print(x28x28);
22+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS
2+
// file for details. All rights reserved. Use of this source code is
3+
// governed by a BSD-style license that can be found in the LICENSE file.
4+
5+
// Implicit language version 2.7 from configuration.
6+
7+
part "src/part_of_im2.7_v_im2.7.dart";
8+
9+
// Specification requires the part fsrc/ile to have
10+
// the same explicit langauge version marker
11+
// as the including library,
12+
// not just the same languge version.
13+
part "src/part_of_im2.7_v_ex2.7.dart";
14+
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
15+
// [analyzer] COMPILE_TIME_ERROR.INCONSISTENT_LANGUAGE_VERSION_OVERRIDE
16+
// [cfe] The language version override has to be the same in the library and its part(s).
17+
18+
part "src/part_of_im2.7_v_ex2.8.dart";
19+
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
20+
// [analyzer] COMPILE_TIME_ERROR.INCONSISTENT_LANGUAGE_VERSION_OVERRIDE
21+
// [cfe] The language version override has to be the same in the library and its part(s).
22+
23+
void main() {
24+
print(i27i27);
25+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS
2+
// file for details. All rights reserved. Use of this source code is
3+
// governed by a BSD-style license that can be found in the LICENSE file.
4+
5+
// @dart=2.7
6+
7+
part of "../lib_ex2.7_test.dart";
8+
9+
var x27x27 = 0;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS
2+
// file for details. All rights reserved. Use of this source code is
3+
// governed by a BSD-style license that can be found in the LICENSE file.
4+
5+
// @dart=2.8
6+
7+
part of "../lib_ex2.7_test.dart";
8+
9+
var v27x28 = 0;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS
2+
// file for details. All rights reserved. Use of this source code is
3+
// governed by a BSD-style license that can be found in the LICENSE file.
4+
5+
// Implicit language version 2.7 from configuration.
6+
7+
part of "../lib_ex2.7_test.dart";
8+
9+
var x27i27 = 0;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS
2+
// file for details. All rights reserved. Use of this source code is
3+
// governed by a BSD-style license that can be found in the LICENSE file.
4+
5+
// @dart=2.7
6+
7+
part of "../lib_ex2.8_test.dart";
8+
9+
var x28x27 = 0;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS
2+
// file for details. All rights reserved. Use of this source code is
3+
// governed by a BSD-style license that can be found in the LICENSE file.
4+
5+
// @dart=2.8
6+
7+
part of "../lib_ex2.8_test.dart";
8+
9+
var x28x28 = 0;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS
2+
// file for details. All rights reserved. Use of this source code is
3+
// governed by a BSD-style license that can be found in the LICENSE file.
4+
5+
// Implicit language version 2.7 from configuration.
6+
7+
part of "../lib_ex2.8_test.dart";
8+
9+
var x28i27 = 0;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS
2+
// file for details. All rights reserved. Use of this source code is
3+
// governed by a BSD-style license that can be found in the LICENSE file.
4+
5+
// @dart=2.7
6+
7+
part of "../lib_im2.7_test.dart";
8+
9+
var i27x27 = 0;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS
2+
// file for details. All rights reserved. Use of this source code is
3+
// governed by a BSD-style license that can be found in the LICENSE file.
4+
5+
// @dart=2.8
6+
7+
part of "../lib_im2.7_test.dart";
8+
9+
var i27x28 = 0;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS
2+
// file for details. All rights reserved. Use of this source code is
3+
// governed by a BSD-style license that can be found in the LICENSE file.
4+
5+
// Implicit language version 2.7 from configuration.
6+
7+
part of "../lib_im2.7_test.dart";
8+
9+
var i27i27 = 0;

0 commit comments

Comments
 (0)