Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 3d878d7

Browse files
author
Dart CI
committed
Version 2.13.0-160.0.dev
Merge commit 'b047c6e1886b21b7f4ccdcbf91fa6e00839afe3d' into 'dev'
2 parents d55476a + b047c6e commit 3d878d7

39 files changed

+756
-326
lines changed

DEPS

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ vars = {
4444
# co19 is a cipd package. Use update.sh in tests/co19[_2] to update these
4545
# hashes. It requires access to the dart-build-access group, which EngProd
4646
# has.
47-
"co19_rev": "1abf208ef6428aac8fee6f3175d65b1c59cd15c8",
47+
"co19_rev": "ae818220b12ec9c2470519db2c7167cbe4745e12",
4848
"co19_2_rev": "cf6eed0535e45413672bb5bb6e65df9f59846372",
4949

5050
# The internal benchmarks to use. See go/dart-benchmarks-internal
@@ -654,8 +654,6 @@ deps_os = {
654654
}
655655
}
656656

657-
# TODO(iposva): Move the necessary tools so that hooks can be run
658-
# without the runtime being available.
659657
hooks = [
660658
{
661659
"name": "firefox_jsshell",

pkg/_fe_analyzer_shared/test/flow_analysis/flow_analysis_mini_ast.dart

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -782,6 +782,7 @@ class _CheckAssigned extends Statement {
782782
class _CheckPromoted extends Statement {
783783
final Var variable;
784784
final String? expectedTypeStr;
785+
final StackTrace _creationTrace = StackTrace.current;
785786

786787
_CheckPromoted(this.variable, this.expectedTypeStr) : super._();
787788

@@ -800,11 +801,7 @@ class _CheckPromoted extends Statement {
800801
void _visit(
801802
Harness h, FlowAnalysis<Node, Statement, Expression, Var, Type> flow) {
802803
var promotedType = flow.promotedType(variable);
803-
if (expectedTypeStr == null) {
804-
expect(promotedType, isNull);
805-
} else {
806-
expect(promotedType?.type, expectedTypeStr);
807-
}
804+
expect(promotedType?.type, expectedTypeStr, reason: '$_creationTrace');
808805
}
809806
}
810807

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
// This test contains a test case for each condition that can lead to the front
6+
// end's `ArgumentTypeNotAssignableNullability` error, for which we wish to
7+
// report "why not promoted" context information.
8+
9+
class C1 {
10+
int? bad;
11+
f(int i) {}
12+
}
13+
14+
required_unnamed(C1 c) {
15+
if (c.bad == null) return;
16+
c.f(
17+
/*analyzer.notPromoted(propertyNotPromoted(target: member:C1.bad, type: int?))*/ c
18+
. /*cfe.notPromoted(propertyNotPromoted(target: member:C1.bad, type: int?))*/ bad);
19+
}
20+
21+
class C2 {
22+
int? bad;
23+
f([int i = 0]) {}
24+
}
25+
26+
optional_unnamed(C2 c) {
27+
if (c.bad == null) return;
28+
c.f(
29+
/*analyzer.notPromoted(propertyNotPromoted(target: member:C2.bad, type: int?))*/ c
30+
. /*cfe.notPromoted(propertyNotPromoted(target: member:C2.bad, type: int?))*/ bad);
31+
}
32+
33+
class C3 {
34+
int? bad;
35+
f({required int i}) {}
36+
}
37+
38+
required_named(C3 c) {
39+
if (c.bad == null) return;
40+
c.f(
41+
/*analyzer.notPromoted(propertyNotPromoted(target: member:C3.bad, type: int?))*/ i:
42+
c. /*cfe.notPromoted(propertyNotPromoted(target: member:C3.bad, type: int?))*/ bad);
43+
}
44+
45+
class C4 {
46+
int? bad;
47+
f({int i = 0}) {}
48+
}
49+
50+
optional_named(C4 c) {
51+
if (c.bad == null) return;
52+
c.f(
53+
/*analyzer.notPromoted(propertyNotPromoted(target: member:C4.bad, type: int?))*/ i:
54+
c. /*cfe.notPromoted(propertyNotPromoted(target: member:C4.bad, type: int?))*/ bad);
55+
}
56+
57+
class C5 {
58+
List<int>? bad;
59+
f<T>(List<T> x) {}
60+
}
61+
62+
type_inferred(C5 c) {
63+
if (c.bad == null) return;
64+
c.f(
65+
/*analyzer.notPromoted(propertyNotPromoted(target: member:C5.bad, type: List<int>?))*/ c
66+
. /*cfe.notPromoted(propertyNotPromoted(target: member:C5.bad, type: List<int>?))*/ bad);
67+
}
68+
69+
class C6 {
70+
int? bad;
71+
C6(int i);
72+
}
73+
74+
C6 constructor_with_implicit_new(C6 c) {
75+
if (c.bad == null) return;
76+
return C6(
77+
/*analyzer.notPromoted(propertyNotPromoted(target: member:C6.bad, type: int?))*/ c
78+
. /*cfe.notPromoted(propertyNotPromoted(target: member:C6.bad, type: int?))*/ bad);
79+
}
80+
81+
class C7 {
82+
int? bad;
83+
C7(int i);
84+
}
85+
86+
C7 constructor_with_explicit_new(C7 c) {
87+
if (c.bad == null) return;
88+
return new C7(
89+
/*analyzer.notPromoted(propertyNotPromoted(target: member:C7.bad, type: int?))*/ c
90+
. /*cfe.notPromoted(propertyNotPromoted(target: member:C7.bad, type: int?))*/ bad);
91+
}

pkg/analysis_server/lib/src/context_manager.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import 'package:analyzer/src/dart/analysis/byte_store.dart';
1515
import 'package:analyzer/src/dart/analysis/driver.dart';
1616
import 'package:analyzer/src/dart/analysis/driver_based_analysis_context.dart';
1717
import 'package:analyzer/src/dart/analysis/performance_logger.dart';
18-
import 'package:analyzer/src/generated/engine.dart';
1918
import 'package:analyzer/src/generated/java_engine.dart';
2019
import 'package:analyzer/src/generated/sdk.dart';
2120
import 'package:analyzer/src/generated/source.dart';

pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
// BSD-style license that can be found in the LICENSE file.
44

55
import 'package:analysis_server/src/protocol_server.dart';
6-
import 'package:analysis_server/src/provisional/completion/completion_core.dart'
7-
show AbortCompletion, CompletionRequest;
86
import 'package:analysis_server/src/provisional/completion/completion_core.dart';
97
import 'package:analysis_server/src/provisional/completion/dart/completion_dart.dart';
108
import 'package:analysis_server/src/services/completion/completion_core.dart';

pkg/analysis_server/test/integration/server/bazel_changes_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,15 +132,15 @@ void main() { my_fun(); }
132132
// error again.
133133
await resetCompleterAndErrors();
134134
writeFile(generatedFilePath, 'different_fun() {}');
135-
writeFile(commandLogPath, 'Build completed successfully');
135+
writeFile(commandLogPath, 'Build completed');
136136

137137
await processedNotification.future;
138138
expect(errors, isNotEmpty);
139139

140140
// Now delete the file completely.
141141
await resetCompleterAndErrors();
142142
File(generatedFilePath).deleteSync();
143-
writeFile(commandLogPath, 'Build completed successfully');
143+
writeFile(commandLogPath, 'Build did NOT complete successfully');
144144

145145
await processedNotification.future;
146146
expect(errors, isNotEmpty);

pkg/analyzer/analysis_options.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ analyzer:
2727
linter:
2828
rules:
2929
- always_use_package_imports
30+
- avoid_dynamic_calls
3031
- avoid_unused_constructor_parameters
3132
- await_only_futures
3233
- empty_statements

pkg/analyzer/lib/src/dart/analysis/driver.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ import 'package:meta/meta.dart';
8080
/// TODO(scheglov) Clean up the list of implicitly analyzed files.
8181
class AnalysisDriver implements AnalysisDriverGeneric {
8282
/// The version of data format, should be incremented on every format change.
83-
static const int DATA_VERSION = 132;
83+
static const int DATA_VERSION = 133;
8484

8585
/// The length of the list returned by [_computeDeclaredVariablesSignature].
8686
static const int _declaredVariablesSignatureLength = 4;

pkg/analyzer/lib/src/dart/ast/constant_evaluator.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,14 @@ class ConstantEvaluator extends GeneralizingAstVisitor<Object> {
179179
if (leftOperand is int && rightOperand is int) {
180180
return leftOperand >> rightOperand;
181181
}
182+
} else if (node.operator.type == TokenType.GT_GT_GT) {
183+
if (leftOperand is int && rightOperand is int) {
184+
// TODO(srawlins): Replace with native VM implementation once stable.
185+
return rightOperand >= 64
186+
? 0
187+
: (leftOperand >> rightOperand) &
188+
((1 << (64 - rightOperand)) - 1);
189+
}
182190
} else if (node.operator.type == TokenType.LT) {
183191
// numeric or {@code null}
184192
if (leftOperand is num && rightOperand is num) {

pkg/analyzer/lib/src/dart/constant/value.dart

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2063,21 +2063,13 @@ class IntState extends NumState {
20632063
var rightValue = rightOperand.value;
20642064
if (rightValue == null) {
20652065
return UNKNOWN_VALUE;
2066-
} else if (rightValue.bitLength > 31) {
2067-
return UNKNOWN_VALUE;
2068-
}
2069-
if (rightValue >= 0) {
2070-
// TODO(brianwilkerson) After the analyzer package has a minimum SDK
2071-
// constraint that includes support for the real operator, consider
2072-
// changing the line below to
2073-
// return new IntState(value >>> rightValue);
2074-
int divisor = 1 << rightValue;
2075-
if (divisor == 0) {
2076-
// The `rightValue` is large enough to cause all of the non-zero bits
2077-
// in the left operand to be shifted out of the value.
2078-
return IntState(0);
2079-
}
2080-
return IntState(value! ~/ divisor);
2066+
} else if (rightValue >= 64) {
2067+
return IntState(0);
2068+
} else if (rightValue >= 0) {
2069+
// TODO(srawlins): Replace with real operator once stable, like:
2070+
// return new IntState(value >>> rightValue);
2071+
return IntState(
2072+
(value! >> rightValue) & ((1 << (64 - rightValue)) - 1));
20812073
}
20822074
}
20832075
throw EvaluationException(CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION);

0 commit comments

Comments
 (0)