Skip to content

Calling an undefined constructor via new is a warning, not an error #3800

Closed

Description

@gbracha

See issue #1031.

Latest version of spec, section 10.10.1 replaces errors with warnings in cases where the class or the constructor is undeclared. Motivation is similar to other cases: do not impose workflow - just warn and make it a dynamic error.

"Let e be a new expression of the form new T.id(a1, .., an, xn+1: an+1, …, xn+k: an+k) or the form new T(a1, .., an, xn+1: an+1, …, xn+k: an+k). It is a static warning if T is not a class or interface accessible in the current scope, optionally followed by type arguments.

If e is of the form new T.id(a1, .., an, xn+1: an+1, …, xn+k: an+k) it is a static warning if T.id is not the name of a constructor declared by the type T. If e of the form new T(a1, .., an, xn+1: an+1, …, xn+k: an+k) it is a static warning if the type T does not declare a constructor with the same name as the declaration of T.
"

Activity

  1. scheglov commented on Jun 26, 2012

    @scheglov
    Contributor

    Added Waiting label.

  2. bwilkerson commented on Aug 10, 2012

    @bwilkerson
    Member

    Added Triaged label.

  3. scheglov commented on Aug 10, 2012

    @scheglov
    Contributor

    Set owner to @scheglov.
    Added Accepted label.

  4. scheglov commented on Aug 10, 2012

    @scheglov
    Contributor
  5. scheglov commented on Aug 10, 2012

    @scheglov
    Contributor
  6. added this to the M1 milestone on Aug 10, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions