Skip to content

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

Closed
@DartBot

Description

@DartBot

This issue was originally filed by ms...@unipro.ru


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.

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