Coder Social home page Coder Social logo

Comments (2)

lrhn avatar lrhn commented on July 2, 2024

Seems like an analyzer bug. There is nothing wrong with the type argument to Wrapper, it's a valid constant type term. (If the spec somehow states that it's not a valid constant type, the bug is also in the spec.)

from sdk.

srawlins avatar srawlins commented on July 2, 2024

The ability to "use a generic function type as a type argument" was introduced in Dart 2.14. If you prepend your example with // @dart=2.13, the VM also gives errors:

a.dart:7:16: Error: A generic function type can't be used as a type argument.
Try using a non-generic function type.
const token1 = Wrapper<TD>();
               ^
a.dart:8:16: Error: A generic function type can't be used as a type argument.
Try using a non-generic function type.
const token2 = Wrapper<A Function<A>(A)>();
               ^

I'm not sure how related that is... but it seems maybe we didn't finsh implementing that feature. I thought this issue might be related to the constructor tearoffs feature, introduced in 2.15, in which type variables became potentially constant:

If T denotes a type variable then T is a potentially constant type expression, and a potentially constant expression.

But the VM accepts the program with // @dart=2.14 (pre-constructor-tearoffs), so 🤷 .

from sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.