Skip to content

CFE allows two identical record literals in a set #50514

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
chloestefantsova opened this issue Nov 18, 2022 · 0 comments
Closed

CFE allows two identical record literals in a set #50514

chloestefantsova opened this issue Nov 18, 2022 · 0 comments
Assignees
Labels
legacy-area-front-end Legacy: Use area-dart-model instead.

Comments

@chloestefantsova
Copy link
Contributor

The following program is expected to provoke in a compile-time error.

class A {
  const A();
}

test() => const <Record>{
  const (1, 2, A()),
  const (1, 2, A())
};

Currently it's accepted by the CFE, and the constant entry contains two references to the same constant #C4.

library /*isNonNullableByDefault*/;
import self as self;
import "dart:core" as core;

class A extends core::Object /*hasConstConstructor*/  {
  const constructor •() → self::A
    : super core::Object::•()
    ;
}
static method test() → dynamic
  return #C5;
constants  {
  #C1 = 1
  #C2 = 2
  #C3 = self::A {}
  #C4 = (#C1, #C2, #C3)
  #C5 = <core::Record*>{#C4, #C4}
}
@chloestefantsova chloestefantsova added the legacy-area-front-end Legacy: Use area-dart-model instead. label Nov 18, 2022
@johnniwinther johnniwinther self-assigned this Nov 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
legacy-area-front-end Legacy: Use area-dart-model instead.
Projects
None yet
Development

No branches or pull requests

2 participants