Skip to content

compilation error #54164

Closed
Closed
@fiurthorn

Description

@fiurthorn

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> {
             ^^^^^^

Activity

added
area-web-jsIssues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.
type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)
on Nov 27, 2023
fishythefish

fishythefish commented on Nov 27, 2023

@fishythefish
Member

AFAIK, that error comes from the CFE.

removed
area-web-jsIssues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.
on Nov 27, 2023
sigmundch

sigmundch commented on Nov 27, 2023

@sigmundch
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

chloestefantsova commented on Dec 12, 2023

@chloestefantsova
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

cfe-dysfunctionalitiesIssues for the CFE not behaving as intendedlegacy-area-front-endLegacy: Use area-dart-model instead.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @fishythefish@chloestefantsova@jakemac53@sigmundch@johnniwinther

      Issue actions

        compilation error · Issue #54164 · dart-lang/sdk