Skip to content

GLB/LUB do not handle generic functions #30237

Closed
@jmesserly

Description

@jmesserly

for example:

void main() {
  var isEven = new DateTime.now().millisecond.isEven;
  var f = isEven ? <T>(T t) => t : <U>(U t) => t;
  print(f<int>(42)); // The method '(<bottom>) → Object' is declared with 0 type parameters, but 1 type arguments were given
}

even worse:

void main() {
  var isEven = new DateTime.now().millisecond.isEven;
  var f = isEven ? <T>() => 42 : <U>() => 42;
  print(f());
}

prints the internal closure used for generic method dispatch (this function object should never be exposed to user code):

Closure: NativeJavaScriptObject from: () => {
    return 42;
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2A bug or feature request we're likely to work ondart-model-analyzer-specIssues with the analyzer's implementation of the language speclanguage-strong-mode-polishlegacy-area-analyzerUse area-devexp instead.soundnesstype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions