typescript-go icon indicating copy to clipboard operation
typescript-go copied to clipboard

Unify the way anonymous class symbols are printed in error messages

Open Andarist opened this issue 8 months ago • 2 comments

This is slightly different from Strada in two ways:

  1. GetNameOfDeclaration is preferred now
  2. (anonymous) becomes (Anonymous class) - which is just more consistent

Andarist avatar Mar 29 '25 14:03 Andarist

I'm not 100% clear why (Anonymous class) is more consistent. The (Missing) change seems correct because it improves a baseline, but otherwise I'm not sure.

jakebailey avatar Mar 31 '25 18:03 jakebailey

This isn't particularly consistent: TS playground. I am surprised now that the first error mentions (Missing) - I could swear I've seen (anonymous) there over the weekend :o But even considering that, this isn't really consistent

(Anonymous class) seems to be way more common in Strada. In its test suite, we can find that 700+ times whereas (anonymous) appears only 4 times (and all of those are within a single test case). (Missing) appears 100+ times but none of those refer to a missing class name.

Andarist avatar Mar 31 '25 21:03 Andarist

Old PR, but it would be worth updating this PR I think, at least into a form that reduces baseline diffs. I'd rather that be the outcome.

jakebailey avatar Jun 04 '25 18:06 jakebailey

@jakebailey done

Andarist avatar Jun 04 '25 20:06 Andarist

Er, well sort of, but it's not reducing diffs, it's still changing the behavior.

jakebailey avatar Jun 04 '25 20:06 jakebailey

It changes one diff and adds it to the accepted changes. I could port this faithfully (to print (anonymous) instead of (Missing)) but then that isn't exactly consistent with some of the other presented cases (IIRC). So I chose to just unify this here while addressing this baseline diff

Andarist avatar Jun 04 '25 21:06 Andarist

Sure, I can port this to Strada

Andarist avatar Jun 25 '25 05:06 Andarist

I created a PR porting this to Strada: https://github.com/microsoft/TypeScript/pull/61943 so I have reverted new tests etc from here given they will come to Corsa automatically once you bump the submodule after that port lands

Andarist avatar Jun 25 '25 08:06 Andarist

I'd leave the tests here; it's fine for tests to be "duplicated" between the two temporarily. The names will not conflict.

jakebailey avatar Jun 25 '25 16:06 jakebailey