Skip to content

compilation error #54164

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

Closed
fiurthorn opened this issue Nov 27, 2023 · 3 comments
Closed

compilation error #54164

fiurthorn opened this issue Nov 27, 2023 · 3 comments
Assignees
Labels
cfe-dysfunctionalities Issues for the CFE not behaving as intended legacy-area-front-end Legacy: Use area-dart-model instead. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@fiurthorn
Copy link

Steps to reproduce

https://github.com/fiurthorn/bug

flutter run -d chrome                                 
Launching lib/main.dart on Chrome in debug mode...
lib/second.dart:3:14: Error: Type 'Entity' can't use itself as a bound.
Try breaking the cycle by removing at least on of the 'extends' clauses in the cycle.
class Second<Entity extends entity.Entity> {
             ^^^^^^
import 'package:bug/entity.dart' as entity;

class Second<Entity extends entity.Entity> {
  Entity entity;

  Second(this.entity);
}

Expected results

until 3.13 the import rename work fine, the dart compiler itself, (and the language server) reports no error, but
the dart2js compiler wont resolve the symbols since 3.16.

Actual results

flutter run -d chrome                                 
Launching lib/main.dart on Chrome in debug mode...
lib/second.dart:3:14: Error: Type 'Entity' can't use itself as a bound.
Try breaking the cycle by removing at least on of the 'extends' clauses in the cycle.
class Second<Entity extends entity.Entity> {
             ^^^^^^
@jakemac53 jakemac53 transferred this issue from dart-lang/language Nov 27, 2023
@jakemac53 jakemac53 added area-web-js Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop. web-dart2js type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Nov 27, 2023
@fishythefish
Copy link
Member

AFAIK, that error comes from the CFE.

@fishythefish fishythefish added the legacy-area-front-end Legacy: Use area-dart-model instead. label Nov 27, 2023
@sigmundch sigmundch removed web-dart2js area-web-js Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop. labels Nov 27, 2023
@sigmundch
Copy link
Member

I've confirmed this is a CFE regression. Simple repro that fails also on the VM and fasta:

a.dart:

class A {}

b.dart:

import 'a.dart' as a;
class B<A extends a.A> {}
main() => B();

@chloestefantsova
Copy link
Contributor

This issue seems to share the underlying cause with #54097. I'm working on a fix at https://dart-review.googlesource.com/c/sdk/+/337183.

copybara-service bot pushed a commit that referenced this issue Dec 15, 2023
This reverts commit 9bb61c0.

Reason for revert: NPE detected in google3.

Original change's description:
> [cfe] Check type variable dependency cycles via extension types
>
> Closes #54097
> Closes #54164
> Part of #49731
>
> Change-Id: I73aac5f7e2c7f05fd0872b37e6f39fa7b5ed4862
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/337183
> Commit-Queue: Chloe Stefantsova <[email protected]>
> Reviewed-by: Johnni Winther <[email protected]>

Change-Id: If1e102112546e333f2e7058e432af142ce7da56e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/341922
Bot-Commit: Rubber Stamper <[email protected]>
Reviewed-by: Johnni Winther <[email protected]>
Commit-Queue: Johnni Winther <[email protected]>
Auto-Submit: Chloe Stefantsova <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cfe-dysfunctionalities Issues for the CFE not behaving as intended legacy-area-front-end Legacy: Use area-dart-model instead. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

6 participants