E.g. class Foo extends Bar, Baz {} would before have parsed weirdly,
but it will parse as you'd (probably) expect with an error saying
you cannot do that. For now at least both CFE and Analyzer will
pretend like you just specified the first one but I suppose Analyzer
could for instance use the extra information to propose converting
other ones to implements clauses or similar.
Fixes https://github.com/dart-lang/sdk/issues/22313
Change-Id: I180cdd8ab07143dd74fd21c9976ec2a46c428d8e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158261
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Although this error condition is not reported by the parser, the
language grammar does not it, so from a customer perspective it is a
parser error. Accordingly, it has been assigned a ParserErrorCode and
is reported by the AstBuilder, as we do for other similar errors.
Change-Id: I22aad9b0acd27bf6e60dfb393837d48a49fc336b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158365
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
There are three ways to initialize a field/variable, so we have to
check for three error conditions:
- At the declaration site
- Via a field formal parameter
- Via a constructor initializer
Change-Id: I14caa38aaf2265966a19c68525f1458ff9d116f0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158363
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This CL contains tests to verify that external fields are not required
to have concrete implementations, but that they imply the need for
getters (and sometimes setters) in concrete subclasses.
Change-Id: I0fb6eca1bc8738a0742e4fc721d66d6b773e0b12
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158203
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
External final fields and variables don't need to be initialized (in
fact they can't be initialized), so we shouldn't report "uninitialized
field" errors for them.
This CL also adds some basic tests of the functionality of external
final fields and variables, making sure they don't introduce setters,
and that the getters they introduce are properly resolved and that
their types are properly respected by inheritance checks.
Change-Id: Ic60042b22b0636b7316119b663629c1c6ced6e2b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158200
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
External fields whose type is non-nullable don't need to be
initialized (in fact they can't be initialized), so we shouldn't
report "uninitialized field" errors for them.
This CL also adds some basic tests of the functionality of external
fields, making sure that the getters and setters they introduce are
properly resolved and that their types are properly respected by
inheritance checks.
Change-Id: I9b08727ab0d45d24801af3721e332c7ec21d08bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157840
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Although these error conditions are not reported by the parser, the
language grammar does not permit them, so from a customer perspective
they are parser errors. Accordingly, they have been assigned
ParserErrorCodes and reported by the AstBuilder, as we do for other
similar errors.
Change-Id: I79d0ad1dcad518981b8b649c117df326279008f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157800
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
There are three ways to initialize a field, so we have to check for
three error conditions:
- At the declaration site
- Via a field formal parameter
- Via a constructor initializer
Fixes#42981
Change-Id: Ifc32a28ffb62d60fd2171d4980e88da9eebcb481
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157664
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This CL covers two cases: when an abstract field appears in a concrete
class (which we report as CONCRETE_CLASS_WITH_ABSTRACT_MEMBER, just as
we do for abstract methods), and when a concrete class implements a
class with an abstract field, but fails to supply the necessary
concrete implementation(s) (which we report as
NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_*, just as we do for
abstract methods).
Change-Id: I94bdbafc4ed7b058d9b33b3774e79cb55393380b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157600
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Abstract final fields don't need to be initialized (in fact they can't
be initialized), so we shouldn't report "uninitialized field" errors
for them.
This CL also adds some basic tests of the functionality of abstract
final fields, making sure they don't introduce setters, and that the
getters they introduce are properly resolved and that their types are
properly respected by inheritance checks.
Change-Id: I885f23ce7ca554ba8f48e932ba9d76e128ac0bbd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157520
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
These tests weren't being referenced in the test's main() function, so
they weren't being run. Fortunately they pass :)
Change-Id: Ie04039e36bbcaea8d13973efb7fee19112407648
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157467
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Abstract fields whose type is non-nullable don't need to be
initialized (in fact they can't be initialized), so we shouldn't
report "uninitialized field" errors for them.
This CL also adds some basic tests of the functionality of abstract
fields, making sure that the getters and setters they introduce are
properly resolved and that their types are properly respected by
inheritance checks.
Change-Id: I1fe7b6f40456d03533b85403ec6f428656820706
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157466
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>