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
Different tear-offs are wrongly identical in CFE #47462
Comments
/cc @alexmarkov |
Not sure I fully understand why these tear-offs should not be identical. @eernstg Could you clarify? Anyway, both
Although the constants C2 and C4 are different, they are structurally equivalent and canonicalized to the same constant at runtime. If we really want those tear-offs to be different, we should fix CFE so it wouldn't evaluate initializer of |
The constructor tearoff specification relies on a concept of a corresponding constructor function, which is a statically resolved function (it could be a top-level function or a static method, but that's up to the compiler and should not matter). Of course, an implementation could choose to implement this in a way that does not use corresponding constructor functions, but the behavior of A type alias like This implies that Generic instantiations of different function objects should not yield the same resulting function object. I think the culprit here could be that @johnniwinther, does this distinction open a can of worms, or would it be a highly localized change? It looks like a distinction between considering the evaluation of |
@johnniwinther @eernstg @leafpetersen - is this a blocking issue for shipping ctor tearoffs? (If so, can you triage to P1, and P2 if not) |
Based on the analysis here, I do believe we specify that Let's consider the opposite position. If we choose to say that |
I thought the CFE already treated |
Consider the following code
v1
andv3
should not be identical, see #47267Tested on
Dart SDK version: 2.15.0-208.0.dev (dev) (Mon Oct 11 22:12:57 2021 -0700) on "windows_x64"
The text was updated successfully, but these errors were encountered: