Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dart allows to extend deferred classes. #42031

Open
iarkh opened this issue May 23, 2020 · 3 comments
Open

Dart allows to extend deferred classes. #42031

iarkh opened this issue May 23, 2020 · 3 comments
Assignees
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues. front-end-missing-error P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@iarkh
Copy link
Contributor

iarkh commented May 23, 2020

Dart VM version: 2.9.0-10.0.dev (dev) (Tue May 19 15:16:48 2020 +0200) on "windows_x64"

The following source code declares a class which extends deferred class:

import "dart:core" deferred as core;

class A extends core.ArgumentError {}

main() {
  new A();
}

Analyzer throws a compile error here whereas dart passes without any errors and warnings.
Sample output is:

$> dartanalyzer test.dart
Analyzing test.dart...
error - Classes can't extend deferred classes. - test.dart:3:17 - extends_deferred_class
1 error found.

$> dart test.dart
$

Seems like according to the Dart Language Spec dart also should throw an exception here.

@lrhn lrhn added area-front-end Use area-front-end for front end / CFE / kernel format related issues. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels May 26, 2020
@johnniwinther
Copy link
Member

See #30273

@sgrekhov
Copy link
Contributor

sgrekhov commented Jun 9, 2020

The same issue exists for mixins as well. Analyzed doesn't allow to mixin deferred classes but CFE allows

import 'deferred_lib.dart' deferred as d;

class B {
}

class C extends B with d.A {} // No isses in CFE, in analyzer error - Classes can't mixin deferred classes.

main() {
  new C();
}

@sgrekhov
Copy link
Contributor

The issue is still exists on CFE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues. front-end-missing-error P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

5 participants