Skip to content

Commit

Permalink
Reland "[dart] Enable constant-update-2018"
Browse files Browse the repository at this point in the history
This reverts commit 83d2aaa.

Reason for revert: Want to reenable const-update-2018 by default.

Original change's description:
> Revert "[dart] Enable constant-update-2018"
> 
> This reverts commit 9bbd319.
> 
> Reason for revert: Reverting enabling of constant-update-2018 by default as some blocking issues were found that are breaking Flutter and preventing rolls of Dart into Flutter. Once the blocking issues are addressed and fixed this CL will be relanded.
> 
> Original change's description:
> > [dart] Enable constant-update-2018
> > 
> > Change-Id: Ib3942b4f6e336a02826305d9f81839333a5464a0
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106943
> > Reviewed-by: Vyacheslav Egorov <[email protected]>
> > Commit-Queue: Vyacheslav Egorov <[email protected]>
> 
> [email protected],[email protected],[email protected],[email protected],[email protected]
> 
> # Not skipping CQ checks because original CL landed > 1 day ago.
> 
> Change-Id: I5796881412cec464f450ff3894ca253c58edc4a2
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109308
> Reviewed-by: Siva Annamalai <[email protected]>
> Reviewed-by: Vijay Menon <[email protected]>

[email protected],[email protected],[email protected],[email protected],[email protected],[email protected]

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I06fbeef318706074c0efcfd42b459bf37c3c92e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/109661
Reviewed-by: Siva Annamalai <[email protected]>
Reviewed-by: Paul Berry <[email protected]>
  • Loading branch information
a-siva committed Jul 25, 2019
1 parent b74ae33 commit d9287f4
Show file tree
Hide file tree
Showing 855 changed files with 8,573 additions and 3,246 deletions.
7 changes: 4 additions & 3 deletions pkg/analyzer/lib/src/dart/analysis/experiments.g.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const _knownFeatures = <String, ExperimentalFeature>{
};

List<bool> _buildExperimentalFlagsArray() => <bool>[
IsEnabledByDefault.constant_update_2018,
true, // constant-update-2018
true, // control-flow-collections
IsEnabledByDefault.extension_methods,
IsEnabledByDefault.non_nullable,
Expand Down Expand Up @@ -74,7 +74,8 @@ class ExperimentalFeatures {
EnableString.constant_update_2018,
IsEnabledByDefault.constant_update_2018,
IsExpired.constant_update_2018,
'Enhanced constant expressions');
'Enhanced constant expressions',
firstSupportedVersion: '2.4.1');

static const control_flow_collections = const ExperimentalFeature(
1,
Expand Down Expand Up @@ -145,7 +146,7 @@ class ExperimentalFeatures {
/// enabled by default.
class IsEnabledByDefault {
/// Default state of the experiment "constant-update-2018"
static const bool constant_update_2018 = false;
static const bool constant_update_2018 = true;

/// Default state of the experiment "control-flow-collections"
static const bool control_flow_collections = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ ExperimentalFlag parseExperimentalFlag(String flag) {
}

const Map<ExperimentalFlag, bool> defaultExperimentalFlags = {
ExperimentalFlag.constantUpdate2018: false,
ExperimentalFlag.constantUpdate2018: true,
ExperimentalFlag.controlFlowCollections: true,
ExperimentalFlag.extensionMethods: false,
ExperimentalFlag.nonNullable: false,
Expand Down
93 changes: 59 additions & 34 deletions pkg/front_end/testcases/general/DeltaBlue.dart.strong.expect
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Strength extends core::Object {
: self::Strength::value = value, self::Strength::name = name, super core::Object::•()
;
method nextWeaker() → self::Strength
return const <self::Strength>[self::STRONG_PREFERRED, self::PREFERRED, self::STRONG_DEFAULT, self::NORMAL, self::WEAK_DEFAULT, self::WEAKEST].{core::List::[]}(this.{self::Strength::value});
return (#C19).{core::List::[]}(this.{self::Strength::value});
static method stronger(self::Strength s1, self::Strength s2) → core::bool {
return s1.{self::Strength::value}.{core::num::<}(s2.{self::Strength::value});
}
Expand Down Expand Up @@ -54,7 +54,7 @@ abstract class Constraint extends core::Object {
method satisfy(dynamic mark) → self::Constraint {
this.{self::Constraint::chooseMethod}(mark as{TypeError} core::int);
if(!this.{self::Constraint::isSatisfied}()) {
if(this.{self::Constraint::strength}.{core::Object::==}(self::REQUIRED)) {
if(this.{self::Constraint::strength}.{core::Object::==}(#C22)) {
core::print("Could not satisfy a required constraint!");
}
return null;
Expand Down Expand Up @@ -131,39 +131,39 @@ class EditConstraint extends self::UnaryConstraint {
abstract class BinaryConstraint extends self::Constraint {
field self::Variable v1;
field self::Variable v2;
field core::int direction = self::NONE;
field core::int direction = #C1;
constructor •(self::Variable v1, self::Variable v2, self::Strength strength) → self::BinaryConstraint
: self::BinaryConstraint::v1 = v1, self::BinaryConstraint::v2 = v2, super self::Constraint::•(strength) {
this.{self::Constraint::addConstraint}();
}
method chooseMethod(core::int mark) → void {
if(this.{self::BinaryConstraint::v1}.{self::Variable::mark}.{core::num::==}(mark)) {
this.{self::BinaryConstraint::direction} = !this.{self::BinaryConstraint::v2}.{self::Variable::mark}.{core::num::==}(mark) && self::Strength::stronger(this.{self::Constraint::strength}, this.{self::BinaryConstraint::v2}.{self::Variable::walkStrength}) ?{core::int} self::FORWARD : self::NONE;
this.{self::BinaryConstraint::direction} = !this.{self::BinaryConstraint::v2}.{self::Variable::mark}.{core::num::==}(mark) && self::Strength::stronger(this.{self::Constraint::strength}, this.{self::BinaryConstraint::v2}.{self::Variable::walkStrength}) ?{core::int} #C4 : #C1;
}
if(this.{self::BinaryConstraint::v2}.{self::Variable::mark}.{core::num::==}(mark)) {
this.{self::BinaryConstraint::direction} = !this.{self::BinaryConstraint::v1}.{self::Variable::mark}.{core::num::==}(mark) && self::Strength::stronger(this.{self::Constraint::strength}, this.{self::BinaryConstraint::v1}.{self::Variable::walkStrength}) ?{core::int} self::BACKWARD : self::NONE;
this.{self::BinaryConstraint::direction} = !this.{self::BinaryConstraint::v1}.{self::Variable::mark}.{core::num::==}(mark) && self::Strength::stronger(this.{self::Constraint::strength}, this.{self::BinaryConstraint::v1}.{self::Variable::walkStrength}) ?{core::int} #C20 : #C1;
}
if(self::Strength::weaker(this.{self::BinaryConstraint::v1}.{self::Variable::walkStrength}, this.{self::BinaryConstraint::v2}.{self::Variable::walkStrength})) {
this.{self::BinaryConstraint::direction} = self::Strength::stronger(this.{self::Constraint::strength}, this.{self::BinaryConstraint::v1}.{self::Variable::walkStrength}) ?{core::int} self::BACKWARD : self::NONE;
this.{self::BinaryConstraint::direction} = self::Strength::stronger(this.{self::Constraint::strength}, this.{self::BinaryConstraint::v1}.{self::Variable::walkStrength}) ?{core::int} #C20 : #C1;
}
else {
this.{self::BinaryConstraint::direction} = self::Strength::stronger(this.{self::Constraint::strength}, this.{self::BinaryConstraint::v2}.{self::Variable::walkStrength}) ?{core::int} self::FORWARD : self::BACKWARD;
this.{self::BinaryConstraint::direction} = self::Strength::stronger(this.{self::Constraint::strength}, this.{self::BinaryConstraint::v2}.{self::Variable::walkStrength}) ?{core::int} #C4 : #C20;
}
}
method addToGraph() → void {
this.{self::BinaryConstraint::v1}.{self::Variable::addConstraint}(this);
this.{self::BinaryConstraint::v2}.{self::Variable::addConstraint}(this);
this.{self::BinaryConstraint::direction} = self::NONE;
this.{self::BinaryConstraint::direction} = #C1;
}
method isSatisfied() → core::bool
return !this.{self::BinaryConstraint::direction}.{core::num::==}(self::NONE);
return !this.{self::BinaryConstraint::direction}.{core::num::==}(#C1);
method markInputs(core::int mark) → void {
this.{self::BinaryConstraint::input}().{self::Variable::mark} = mark;
}
method input() → self::Variable
return this.{self::BinaryConstraint::direction}.{core::num::==}(self::FORWARD) ?{self::Variable} this.{self::BinaryConstraint::v1} : this.{self::BinaryConstraint::v2};
return this.{self::BinaryConstraint::direction}.{core::num::==}(#C4) ?{self::Variable} this.{self::BinaryConstraint::v1} : this.{self::BinaryConstraint::v2};
method output() → self::Variable
return this.{self::BinaryConstraint::direction}.{core::num::==}(self::FORWARD) ?{self::Variable} this.{self::BinaryConstraint::v2} : this.{self::BinaryConstraint::v1};
return this.{self::BinaryConstraint::direction}.{core::num::==}(#C4) ?{self::Variable} this.{self::BinaryConstraint::v2} : this.{self::BinaryConstraint::v1};
method recalculate() → void {
self::Variable ihn = this.{self::BinaryConstraint::input}();
self::Variable out = this.{self::BinaryConstraint::output}();
Expand All @@ -173,7 +173,7 @@ abstract class BinaryConstraint extends self::Constraint {
this.{self::Constraint::execute}();
}
method markUnsatisfied() → void {
this.{self::BinaryConstraint::direction} = self::NONE;
this.{self::BinaryConstraint::direction} = #C1;
}
method inputsKnown(core::int mark) → core::bool {
self::Variable i = this.{self::BinaryConstraint::input}();
Expand All @@ -184,7 +184,7 @@ abstract class BinaryConstraint extends self::Constraint {
this.{self::BinaryConstraint::v1}.{self::Variable::removeConstraint}(this);
if(!this.{self::BinaryConstraint::v2}.{core::Object::==}(null))
this.{self::BinaryConstraint::v2}.{self::Variable::removeConstraint}(this);
this.{self::BinaryConstraint::direction} = self::NONE;
this.{self::BinaryConstraint::direction} = #C1;
}
}
class ScaleConstraint extends self::BinaryConstraint {
Expand All @@ -210,7 +210,7 @@ class ScaleConstraint extends self::BinaryConstraint {
this.{self::ScaleConstraint::scale}.{self::Variable::mark} = this.{self::ScaleConstraint::offset}.{self::Variable::mark} = mark;
}
method execute() → void {
if(this.{self::BinaryConstraint::direction}.{core::num::==}(self::FORWARD)) {
if(this.{self::BinaryConstraint::direction}.{core::num::==}(#C4)) {
this.{self::BinaryConstraint::v2}.{self::Variable::value} = this.{self::BinaryConstraint::v1}.{self::Variable::value}.{core::num::*}(this.{self::ScaleConstraint::scale}.{self::Variable::value}).{core::num::+}(this.{self::ScaleConstraint::offset}.{self::Variable::value});
}
else {
Expand Down Expand Up @@ -238,7 +238,7 @@ class Variable extends core::Object {
field core::List<self::Constraint> constraints = <self::Constraint>[];
field self::Constraint determinedBy = null;
field core::int mark = 0;
field self::Strength walkStrength = self::WEAKEST;
field self::Strength walkStrength = #C18;
field core::bool stay = true;
field core::int value;
final field core::String name;
Expand Down Expand Up @@ -269,7 +269,7 @@ class Planner extends core::Object {
c.{self::Constraint::markUnsatisfied}();
c.{self::Constraint::removeFromGraph}();
core::List<self::Constraint> unsatisfied = this.{self::Planner::removePropagateFrom}(out);
self::Strength strength = self::REQUIRED;
self::Strength strength = #C22;
do {
for (core::int i = 0; i.{core::num::<}(unsatisfied.{core::List::length}); i = i.{core::num::+}(1)) {
self::Constraint u = unsatisfied.{core::List::[]}(i);
Expand All @@ -278,7 +278,7 @@ class Planner extends core::Object {
}
strength = strength.{self::Strength::nextWeaker}();
}
while (!strength.{core::Object::==}(self::WEAKEST))
while (!strength.{core::Object::==}(#C18))
}
method newMark() → core::int
return this.{self::Planner::currentMark} = this.{self::Planner::currentMark}.{core::num::+}(1);
Expand Down Expand Up @@ -320,7 +320,7 @@ class Planner extends core::Object {
}
method removePropagateFrom(self::Variable out) → core::List<self::Constraint> {
out.{self::Variable::determinedBy} = null;
out.{self::Variable::walkStrength} = self::WEAKEST;
out.{self::Variable::walkStrength} = #C18;
out.{self::Variable::stay} = true;
core::List<self::Constraint> unsatisfied = <self::Constraint>[];
core::List<self::Variable> todo = <self::Variable>[out];
Expand Down Expand Up @@ -367,16 +367,16 @@ class Plan extends core::Object {
}
}
}
static const field self::Strength REQUIRED = const self::Strength::•(0, "required");
static const field self::Strength STRONG_PREFERRED = const self::Strength::•(1, "strongPreferred");
static const field self::Strength PREFERRED = const self::Strength::•(2, "preferred");
static const field self::Strength STRONG_DEFAULT = const self::Strength::•(3, "strongDefault");
static const field self::Strength NORMAL = const self::Strength::•(4, "normal");
static const field self::Strength WEAK_DEFAULT = const self::Strength::•(5, "weakDefault");
static const field self::Strength WEAKEST = const self::Strength::•(6, "weakest");
static const field core::int NONE = 1;
static const field core::int FORWARD = 2;
static const field core::int BACKWARD = 0;
static const field self::Strength REQUIRED = #C22;
static const field self::Strength STRONG_PREFERRED = #C3;
static const field self::Strength PREFERRED = #C6;
static const field self::Strength STRONG_DEFAULT = #C9;
static const field self::Strength NORMAL = #C12;
static const field self::Strength WEAK_DEFAULT = #C15;
static const field self::Strength WEAKEST = #C18;
static const field core::int NONE = #C1;
static const field core::int FORWARD = #C4;
static const field core::int BACKWARD = #C20;
static field self::Planner planner;
static method main() → dynamic {
new self::DeltaBlue::•().{self::DeltaBlue::run}();
Expand All @@ -389,15 +389,15 @@ static method chainTest(core::int n) → void {
for (core::int i = 0; i.{core::num::<=}(n); i = i.{core::num::+}(1)) {
self::Variable v = new self::Variable::•("v${i}", 0);
if(!prev.{core::Object::==}(null))
new self::EqualityConstraint::•(prev, v, self::REQUIRED);
new self::EqualityConstraint::•(prev, v, #C22);
if(i.{core::num::==}(0))
first = v;
if(i.{core::num::==}(n))
last = v;
prev = v;
}
new self::StayConstraint::•(last, self::STRONG_DEFAULT);
self::EditConstraint edit = new self::EditConstraint::•(first, self::PREFERRED);
new self::StayConstraint::•(last, #C9);
self::EditConstraint edit = new self::EditConstraint::•(first, #C6);
self::Plan plan = self::planner.{self::Planner::extractPlanFromConstraints}(<self::Constraint>[edit]);
for (core::int i = 0; i.{core::num::<}(100); i = i.{core::num::+}(1)) {
first.{self::Variable::value} = i;
Expand All @@ -419,8 +419,8 @@ static method projectionTest(core::int n) → void {
src = new self::Variable::•("src", i);
dst = new self::Variable::•("dst", i);
dests.{core::List::add}(dst);
new self::StayConstraint::•(src, self::NORMAL);
new self::ScaleConstraint::•(src, scale, offset, dst, self::REQUIRED);
new self::StayConstraint::•(src, #C12);
new self::ScaleConstraint::•(src, scale, offset, dst, #C22);
}
self::change(src, 17);
if(!dst.{self::Variable::value}.{core::num::==}(1170))
Expand All @@ -440,11 +440,36 @@ static method projectionTest(core::int n) → void {
}
}
static method change(self::Variable v, core::int newValue) → void {
self::EditConstraint edit = new self::EditConstraint::•(v, self::PREFERRED);
self::EditConstraint edit = new self::EditConstraint::•(v, #C6);
self::Plan plan = self::planner.{self::Planner::extractPlanFromConstraints}(<self::EditConstraint>[edit]);
for (core::int i = 0; i.{core::num::<}(10); i = i.{core::num::+}(1)) {
v.{self::Variable::value} = newValue;
plan.{self::Plan::execute}();
}
edit.{self::Constraint::destroyConstraint}();
}

constants {
#C1 = 1
#C2 = "strongPreferred"
#C3 = self::Strength {value:#C1, name:#C2}
#C4 = 2
#C5 = "preferred"
#C6 = self::Strength {value:#C4, name:#C5}
#C7 = 3
#C8 = "strongDefault"
#C9 = self::Strength {value:#C7, name:#C8}
#C10 = 4
#C11 = "normal"
#C12 = self::Strength {value:#C10, name:#C11}
#C13 = 5
#C14 = "weakDefault"
#C15 = self::Strength {value:#C13, name:#C14}
#C16 = 6
#C17 = "weakest"
#C18 = self::Strength {value:#C16, name:#C17}
#C19 = <self::Strength>[#C3, #C6, #C9, #C12, #C15, #C18]
#C20 = 0
#C21 = "required"
#C22 = self::Strength {value:#C20, name:#C21}
}
Loading

0 comments on commit d9287f4

Please sign in to comment.