Skip to content

Option: force types (with warnings/errors) #451

Closed
@DartBot

Description

@DartBot

This issue was originally filed by ole...@gmail.com


Optional types is a great idea, but for those of us who want to use types everywhere it would be nice to have an option to let Dart ensure that they really are used everywhere.

It is easy to forget adding a type somewhere. In that case I may think the program is type-correct (no warnings or errors in checked mode), because I thought I added types to everything, but it really isn't.

As it is now, if you forget a type somewhere even with "Checked mode" activated on the Dartboard there are no warnings about missing types.

Concrete example:

main(){}

int someFunc(var strX)
{
  int y = strX - 1;
  return y;
}

If I choose to have Dart force types (either through warnings or errors as in checked mode), Dart should warn me there is no type on strX. I would then add a type on strX (String) and get the type warning/error on the subtraction operation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    closed-not-plannedClosed as we don't intend to take action on the reported issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions