// Copyright (c) 2019, 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.
import "package:expect/expect.dart";

// SharedOptions=--enable-experiment=non-nullable
void main() {
}

/// These tests will all pass only if run with the NNBD migrated SDK.
/// In not migrated SDK all types are unprefixed, so look non-nullable.
void f(List<int> list, Map<int, String> map, int a, int? b) {
  // List: E operator [](int index);
  list[a]; //# 00: ok
  list[b]; //# 01: compile-time error

  // Map: V? operator [](Object? key);
  map[a]; //# 02: ok
  map[b]; //# 03: ok

  // Map: void operator []=(K key, V value);
  map[a].length; //# 04: compile-time error
  map[a]?.length; //# 05: ok

  map[b] = ''; //# 06: compile-time error
  map[a] = b; //# 07: compile-time error
}

Add a NNBD test that needs NNBD migrated SDK.
Add a NNBD test that needs NNBD migrated SDK.

I tested it locally by updating `SharedOptions` to include not only
`--enable-experiment=non-nullable`, but also the forced path to NNBD
SDK: `--dart-sdk=/Users/scheglov/Applications/dart-sdk-NNBD`.

This will fail for now, I will accept current bot failures.

Change-Id: I72c9b46049de6cd25eddebd43d5c73c2fc9d7825
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/124168
Reviewed-by: Brian Wilkerson <1f7641b6b14c52b9163524ab8d9aabff80176f21@google.com>
Reviewed-by: Paul Berry <72d414e3a99fb120308437779d51667bcc0984eb@google.com>
Commit-Queue: Konstantin Shcheglov <09e4d7516628963212bf4aace2f97603d2b706e4@google.com>
