Skip to content

Invalid main accepted by the front end #56122

Open
@osa1

Description

@osa1
void main<T>() {
  print(T);
  print('hi');
}

According to the spec section 19.6, for main to be called executed it needs to have zero, one, or two arguments.

If a library exports main but it's not a script then it's a compile time error.

However the program above is accepted by the front end.

How it works today is VM runs it by doing a dynamic invocation:

Which passes dynamic for the missing type arguments.

Instead this program should be rejected by the front end, per spec.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-languageDart language related items (some items might be better tracked at github.com/dart-lang/language).cfe-pendingCFE issues that need more information to be triaged.legacy-area-front-endLegacy: Use area-dart-model instead.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions