[tests] Add language test for field accesses on constant-like record.

Change-Id: I4748f14fd77e4422823af2b7e60d61a57339e19c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291641
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
This commit is contained in:
Nate Biggs 2023-03-28 22:02:52 +00:00 committed by Commit Queue
parent 7c0e4d67c7
commit f9fba691ea

View file

@ -0,0 +1,15 @@
// Copyright (c) 2023, 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.
// SharedOptions=--enable-experiment=records
// Verifies that constant-like records are correctly simplified into a constant
// record by the backends who perform such optimizations.
//
// Regression test for https://github.com/dart-lang/sdk/issues/51883.
void main() {
final x = ([1, 2], 3);
(x.$1).add(4);
}