blob: b014d7c2ada117b7ec19f9123d15147dacc3fa54 [file] [log] [blame]
// Copyright (c) 2021, 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.
/// @assertion We infer the type of a parameter declaration, p, of a
/// non-redirecting generative constructor, C, as:
/// ...
/// Otherwise, if the parameter is a super parameter (super.name) the inferred
/// type of the parameter is the associated super-constructor parameter (which
/// must exist, otherwise we’d have a compile-time error).
///
/// @description Check that if the parameter is a super parameter (super.name)
/// the inferred type of the parameter is the associated super-constructor
/// parameter
/// @author sgrekhov@unipro.ru
// SharedOptions=--enable-experiment=super-parameters
class S {
var s1;
S(num x) : s1 = x;
}
class C extends S {
var i1;
C(this.i1, super.x);
}
main() {
C(1, 2);
C(1, 3.14);
C(1, "2");
// ^^^
// [analyzer] unspecified
// [cfe] unspecified
C(1, Object());
// ^^^^^^^^
// [analyzer] unspecified
// [cfe] unspecified
}