// 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';

abstract class A<T> {
  foo(T x);
}

abstract class B<T> implements A<T> {}

class C {
  foo(num x) {
    if (x is! num) {
      throw "Soudness issue: expected x to be num, got ${x.runtimeType}.";
    }
  }
}

class D<T extends num> extends C with B<T> {}

class E<T extends num> = C with B<T>;

test(B<dynamic> b) {
  b.foo("bar");
}

main() {
  Expect.throws<TypeError>(() => test(new D<int>()));
  Expect.throws<TypeError>(() => test(new E<int>()));
}

Add test for runtime checks in mixins with implicit covariance
[fasta] Add test for runtime checks in mixins with implicit covariance

Change-Id: I7e9d7cd6d3a8e27570dd6b7a882e3ad7a63acb60
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104783
Reviewed-by: Kevin Millikin <a6737c91ef81c790d8ad0ae8762bd5b2332a6e42@google.com>
Reviewed-by: Erik Ernst <251bb01623bfda2cd9151e339a6e783ca432874c@google.com>
Commit-Queue: Dmitry Stefantsov <95a4b7e39916a54bd6477bec6a6de014b977db32@google.com>
