Update constant_expression_test to match CFE encoding

Closes #32511

Change-Id: I7a76bff6ed59023edbb4d678991d627b683ddf6f
Reviewed-on: https://dart-review.googlesource.com/52220
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
This commit is contained in:
Johnni Winther 2018-04-20 20:03:59 +00:00 committed by commit-bot@chromium.org
parent a5ea3c5e33
commit 4e6e68fca8

View file

@ -57,7 +57,9 @@ const List<TestData> DATA = const [
const ConstantData('1 + 2', ConstantExpressionKind.BINARY), const ConstantData('1 + 2', ConstantExpressionKind.BINARY),
const ConstantData('1 == 2', ConstantExpressionKind.BINARY), const ConstantData('1 == 2', ConstantExpressionKind.BINARY),
// TODO(sigmund): reenable (Issue 32511) // TODO(sigmund): reenable (Issue 32511)
// const ConstantData('1 != 2', ConstantExpressionKind.BINARY), const ConstantData('1 != 2', ConstantExpressionKind.UNARY,
// a != b is encoded as !(a == b) by CFE.
text: '!(1 == 2)'),
const ConstantData('1 ?? 2', ConstantExpressionKind.BINARY), const ConstantData('1 ?? 2', ConstantExpressionKind.BINARY),
const ConstantData('-(1)', ConstantExpressionKind.UNARY, text: '-1'), const ConstantData('-(1)', ConstantExpressionKind.UNARY, text: '-1'),
const ConstantData('"foo".length', ConstantExpressionKind.STRING_LENGTH), const ConstantData('"foo".length', ConstantExpressionKind.STRING_LENGTH),
@ -156,34 +158,44 @@ class C<U> {
'const A<int>(field1: 87)', ConstantExpressionKind.CONSTRUCTED, 'const A<int>(field1: 87)', ConstantExpressionKind.CONSTRUCTED,
type: 'A<int>', fields: const {'field(A#field1)': '87'}), type: 'A<int>', fields: const {'field(A#field1)': '87'}),
// TODO(sigmund): reenable (Issue 32511) // TODO(sigmund): reenable (Issue 32511)
//const ConstantData('const B()', ConstantExpressionKind.CONSTRUCTED, const ConstantData('const B()', ConstantExpressionKind.CONSTRUCTED,
// type: 'A<B<dynamic>>', type: 'A<B<dynamic>>',
// fields: const { fields: const {
// 'field(A#field1)': '42', 'field(A#field1)': '42',
// }), },
//const ConstantData('const B<int>()', ConstantExpressionKind.CONSTRUCTED, // Redirecting factories are replaced by their effective targets by CFE.
// type: 'A<B<int>>', text: 'const A<B<dynamic>>()'),
// fields: const { const ConstantData('const B<int>()', ConstantExpressionKind.CONSTRUCTED,
// 'field(A#field1)': '42', type: 'A<B<int>>',
// }), fields: const {
//const ConstantData( 'field(A#field1)': '42',
// 'const B<int>(field1: 87)', ConstantExpressionKind.CONSTRUCTED, },
// type: 'A<B<int>>', // Redirecting factories are replaced by their effective targets by CFE.
// fields: const { text: 'const A<B<int>>()'),
// 'field(A#field1)': '87', const ConstantData(
// }), 'const B<int>(field1: 87)', ConstantExpressionKind.CONSTRUCTED,
//const ConstantData( type: 'A<B<int>>',
// 'const C<int>(field1: 87)', ConstantExpressionKind.CONSTRUCTED, fields: const {
// type: 'A<B<double>>', 'field(A#field1)': '87',
// fields: const { },
// 'field(A#field1)': '87', // Redirecting factories are replaced by their effective targets by CFE.
// }), text: 'const A<B<int>>(field1: 87)'),
//const ConstantData( const ConstantData(
// 'const B<int>.named()', ConstantExpressionKind.CONSTRUCTED, 'const C<int>(field1: 87)', ConstantExpressionKind.CONSTRUCTED,
// type: 'A<int>', type: 'A<B<double>>',
// fields: const { fields: const {
// 'field(A#field1)': '42', 'field(A#field1)': '87',
// }), },
// Redirecting factories are replaced by their effective targets by CFE.
text: 'const A<B<double>>(field1: 87)'),
const ConstantData(
'const B<int>.named()', ConstantExpressionKind.CONSTRUCTED,
type: 'A<int>',
fields: const {
'field(A#field1)': '42',
},
// Redirecting factories are replaced by their effective targets by CFE.
text: 'const A<int>()'),
]), ]),
]; ];