dart-sdk/tests/language/unsorted/index_assign_operator_infer_return_type_test.dart
Johnni Winther 7130dd4d3d [cfe] Report error on non-void setter return type
This CL also adds fileUri/charOffset to all TypeBuilder's and renames
Void/FutureOr/Never/Dynamic/BuiltInTypeBuilder to *TypeDeclarationBuilder
so match their relation to TypeBuilder/TypeDeclarationBuilder.

Closes #42962

Change-Id: Iee5102134574d24f748103282a37bb9a85a0ac2d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161165
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2020-09-02 12:43:12 +00:00

21 lines
661 B
Dart

// Copyright (c) 2018, 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.
class C {
operator []=(dynamic index, dynamic value) {}
}
abstract class I {
void operator []=(dynamic index, dynamic value) {}
}
class D extends C implements I {
// Even though `C` and `I` define different return types for `operator[]=`, it
// should still be possible to infer a return type here, since the return type
// of `operator[]=` is always inferred as `void`.
operator []=(dynamic index, dynamic value) {}
}
main() {}