Skip to content

Dartc: Default class without constructor does not cause a compile-time error #985

Closed

Description

@DartBot

This issue was originally filed by [email protected]


In the section 7.5 the specification says: "If no constructor is specified for a class C, it implicitly has a default constructor C() : super() {}, unless it is class Object."
In the section 8.3: "A constructor kI of I corresponds to a constructor kF of its factory class F if either F does not implement I and kI and kF have the same name, OR ... It is a compile-time error if an interface I declares a constructor kI and there is no constructor kF in the factory class F such that kI corresponds to kF ."

The test is following:
class F {
}

interface I default F {
  I();
}

main() {
  new I();
}

According to the specification, there is implicit constructor F():super() {} in the class F. But this is not the constructor to which constructor I() corresponds. So, a compile-time error have to occur. But dartc(r2810) does not produce it.

Activity

  1. dgrove commented on Jan 2, 2012

    @dgrove
    Contributor

    Added Area-Compiler, Triaged labels.

  2. jtmcdole commented on Jan 10, 2012

    @jtmcdole
    Contributor

    Set owner to @jtmcdole.
    Added Accepted label.

  3. added a commit that references this issue on Jan 25, 2021
    a828308
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions