// Copyright (c) 2020, 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.

void main() {
  try {} catch (error) {
    error.notAMethodOnObject();
    //    ^^^^^^^^^^^^^^^^^^
    // [analyzer] STATIC_TYPE_WARNING.UNDEFINED_METHOD
    // [cfe] The method 'notAMethodOnObject' isn't defined for the class 'Object'.
    _takesObject(error);
  }
}

void _takesObject(Object o) {}

Add a static error test for default catch type
Add a static error test for default catch type

Static error test for https://github.com/dart-lang/language/issues/922

If the type of the error argument was `dynamic` there would be no error
for calling a method that does not exist.

If the type of the error argument was `Object?` there would be an error
for the call to `_takesObject`.

Change-Id: I3cec1a8ae2903887e5da086cdeecd4008ef5d667
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143329
Commit-Queue: Nate Bosch <dc212c74d8afde9c690fdd09e74d3e5c5d5a3de0@google.com>
Reviewed-by: Leaf Petersen <9bef692239b5f624cec8e2cd5249ab1939a377aa@google.com>
