You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
"Special" intersections (such as string & {}) are no longer order-independent since 4.8 #53043
Ye, at the end of the day - I don't think this is a big deal. However, I actually lost like 15 minutes of my life, scratching my head why this thing doesn't work - only to realize later that I've written those two in reverse order. A general rule of thumb is that the order of the intersection shouldn't matter, right?
A general rule of thumb is that the order of the intersection shouldn't matter, right?
This is what I thought, and I spent a bunch of time trying to make them sorted, but it does matter for overload ordering and that can affect basically anything. I can't think of any reason for it to matter for explicitly just string & {} though.
That being said, it seems cheap to just compare them both ways.
Activity
fatcerberus commentedon Mar 1, 2023
Was looking for the dupe for like 10 minutes because I knew this had come up very recently. Felt stupid when I finally realized it was your own PR.
andrewbranch commentedon Mar 1, 2023
I’m pretty sure I recall Anders saying this was intentional, though #49119 doesn’t say outright.
Andarist commentedon Mar 2, 2023
Ye, at the end of the day - I don't think this is a big deal. However, I actually lost like 15 minutes of my life, scratching my head why this thing doesn't work - only to realize later that I've written those two in reverse order. A general rule of thumb is that the order of the intersection shouldn't matter, right?
jakebailey commentedon Mar 2, 2023
This is what I thought, and I spent a bunch of time trying to make them sorted, but it does matter for overload ordering and that can affect basically anything. I can't think of any reason for it to matter for explicitly just
string & {}though.That being said, it seems cheap to just compare them both ways.
RyanCavanaugh commentedon Mar 2, 2023
Anders Hejlsberg (@ahejlsberg) any specific thoughts?
RyanCavanaugh commentedon Mar 2, 2023
Very close to making a specific "Not sure if bug, but Andarist can certainly send a PR if interested" label...
jakebailey commentedon Mar 2, 2023
Too late: #52782
ahejlsberg commentedon Mar 2, 2023
I don't feel strongly about fixing this, but the fix certainly looks fine to me.
ahejlsberg commentedon Mar 2, 2023
That said, we should of course run the full battery of tests on the fix to make sure it doesn't break anything.