-
Notifications
You must be signed in to change notification settings - Fork 6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CFE] [Language versioning] Issue error on multiple 'dart=' entries
Issue error when the .packages file specifies more than on 'dart=' entry. Also add another test of the library and part mismatch being an error. Change-Id: I0a894e6ef86eb9f976b9fbdce67f0c9adb03be9b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/112881 Commit-Queue: Jens Johansen <jensj@google.com> Reviewed-by: Johnni Winther <johnniwinther@google.com>
- Loading branch information
Showing
12 changed files
with
105 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_3/.packages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
foo:lib/#dart=2.5&dart=arglebargle |
13 changes: 13 additions & 0 deletions
13
pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_3/lib/foo.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/*error: LanguageVersionInvalidInDotPackages*/ | ||
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
/*library: languageVersion=2.8*/ | ||
|
||
import 'foo2.dart'; | ||
|
||
foo() { | ||
print("Hello from foo!"); | ||
foo2(); | ||
} |
12 changes: 12 additions & 0 deletions
12
pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_3/lib/foo2.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/*error: LanguageVersionInvalidInDotPackages*/ | ||
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
// @dart = 2.4 | ||
|
||
/*library: languageVersion=2.4*/ | ||
|
||
foo2() { | ||
print("Hello from foo2!"); | ||
} |
16 changes: 16 additions & 0 deletions
16
pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_3/main.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
// Set version of this file (not technically in package) explicitly to test as | ||
// much as possibly separately. | ||
|
||
// @dart = 2.4 | ||
|
||
import 'package:foo/foo.dart'; | ||
|
||
/*library: languageVersion=2.4*/ | ||
|
||
main() { | ||
foo(); | ||
} |
5 changes: 5 additions & 0 deletions
5
pkg/front_end/test/language_versioning/data/package_default_version_is_wrong_3/pubspec.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file | ||
# for details. All rights reserved. Use of this source code is governed by a | ||
# BSD-style license that can be found in the LICENSE file. | ||
|
||
# Analyzer workaround, see https://github.com/dart-lang/sdk/issues/37513 |
1 change: 1 addition & 0 deletions
1
pkg/front_end/test/language_versioning/data/parts_disagreeing_has_package_2/.packages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
foo:lib/#dart=2.5 |
14 changes: 14 additions & 0 deletions
14
pkg/front_end/test/language_versioning/data/parts_disagreeing_has_package_2/lib/foo.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
// The library and its part is both technically at language version 2.5, | ||
// but one is explicitly set, the other is not. That's an error. | ||
|
||
part /*error: LanguageVersionMismatchInPart*/ 'part.dart'; | ||
|
||
/*library: languageVersion=2.5*/ | ||
|
||
foo() { | ||
/*error: MethodNotFound*/ bar(); | ||
} |
9 changes: 9 additions & 0 deletions
9
pkg/front_end/test/language_versioning/data/parts_disagreeing_has_package_2/lib/part.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
// @dart = 2.5 | ||
|
||
part of 'foo.dart'; | ||
|
||
bar() {} |
16 changes: 16 additions & 0 deletions
16
pkg/front_end/test/language_versioning/data/parts_disagreeing_has_package_2/main.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
// Set version of this file (not technically in package) explicitly to test as | ||
// much as possibly separately. | ||
|
||
// @dart = 2.4 | ||
|
||
import 'package:foo/foo.dart'; | ||
|
||
/*library: languageVersion=2.4*/ | ||
|
||
main() { | ||
main(); | ||
} |
5 changes: 5 additions & 0 deletions
5
pkg/front_end/test/language_versioning/data/parts_disagreeing_has_package_2/pubspec.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file | ||
# for details. All rights reserved. Use of this source code is governed by a | ||
# BSD-style license that can be found in the LICENSE file. | ||
|
||
# Analyzer workaround, see https://github.com/dart-lang/sdk/issues/37513 |