-
Notifications
You must be signed in to change notification settings - Fork 1.7k
CFE allows calling record with call
field as a function.
#54616
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Just read #54351 where it's mentioned that we don't want |
@chloestefantsova Can you take a look at this for the CFE? (I don't think this is done in shared code) |
Sure! Will do. |
call
field as a function.call
field as a function.
call
field as a function.call
field as a function.
Since this is (probably) not shared code, I split it into an analyzer issue (#54651), and made this issue CFE-specific. |
Am I right to assume the calls to |
Yes. A record type is not a callable type since it doesn't have a (It can accept an extension |
Example:
Both
c(1)
andc2(1)
should be compile-time errors since their static type is not a function type,and it's not a type which has a
call
method. It has acall
getter, but that's not sufficient to allow a.call
insertion to be performed.The analyzer allows it, but then doesn't know what to do about it, so the type of the call ends up as
dynamic
.The front-end allows it and gives the return type of the function.
See: dart-lang/language#3558
The text was updated successfully, but these errors were encountered: