Version 2.14.0-59.0.dev
Merge commit 'f193637d826113fa4ca074d1e075c8ee7ec42e62' into 'dev'
diff --git a/pkg/analyzer/lib/src/util/yaml.dart b/pkg/analyzer/lib/src/util/yaml.dart
index 108ea8d..dfa104e 100644
--- a/pkg/analyzer/lib/src/util/yaml.dart
+++ b/pkg/analyzer/lib/src/util/yaml.dart
@@ -30,7 +30,7 @@
/// * maps are merged recursively.
/// * if map values cannot be merged, the overriding value is taken.
///
- YamlNode merge(YamlNode o1, YamlNode? o2) {
+ YamlNode merge(YamlNode o1, YamlNode o2) {
// Handle promotion first.
YamlMap listToMap(YamlList list) {
Map<YamlNode, YamlNode> map =
@@ -56,7 +56,10 @@
return mergeList(o1, o2);
}
// Default to override, unless the overriding value is `null`.
- return o2 ?? o1;
+ if (o2 is YamlScalar && o2.value == null) {
+ return o1;
+ }
+ return o2;
}
/// Merge lists, avoiding duplicates.
@@ -75,7 +78,7 @@
YamlMap mergeMap(YamlMap m1, YamlMap m2) {
Map<YamlNode, YamlNode> merged =
HashMap<YamlNode, YamlNode>(); // equals: _equals, hashCode: _hashCode
- m1.nodes.forEach((k, v) {
+ m1.nodeMap.forEach((k, v) {
merged[k] = v;
});
m2.nodeMap.forEach((k, v) {
diff --git a/pkg/analyzer/test/source/analysis_options_provider_test.dart b/pkg/analyzer/test/source/analysis_options_provider_test.dart
index 64cc0a4..787f65c 100644
--- a/pkg/analyzer/test/source/analysis_options_provider_test.dart
+++ b/pkg/analyzer/test/source/analysis_options_provider_test.dart
@@ -195,6 +195,31 @@
}
}
+ void test_getOptions_include_emptyLints() {
+ pathTranslator.newFile('/foo.include', r'''
+linter:
+ rules:
+ - prefer_single_quotes
+''');
+ pathTranslator.newFile('/$analysisOptionsYaml', r'''
+include: foo.include
+linter:
+ rules:
+ # avoid_print: false
+''');
+ YamlMap options = _getOptions('/');
+ expect(options, hasLength(2));
+ {
+ var linter = options.valueAt('linter') as YamlMap;
+ expect(linter, hasLength(1));
+ {
+ var rules = linter.valueAt('rules') as YamlList;
+ expect(rules, hasLength(1));
+ expect(rules[0], 'prefer_single_quotes');
+ }
+ }
+ }
+
void test_getOptions_include_missing() {
pathTranslator.newFile('/$analysisOptionsYaml', r'''
include: /foo.include
diff --git a/tools/VERSION b/tools/VERSION
index 1372d22..82a934e 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 14
PATCH 0
-PRERELEASE 58
+PRERELEASE 59
PRERELEASE_PATCH 0
\ No newline at end of file