Skip to content

Conversation

@leaysgur
Copy link
Member

class E1 {}
class E2 {}

class X1 extends E1 {}
// class X2 extends E1 extends E2 {}
class X3 implements E1 {}
// class X4 implements E1 implements E2 {}
class X5 extends E1 implements E2 {}
// class X6 implements E1 extends E2 {}

interface Y1 extends E1 {}
// interface Y2 extends E1 extends E2 {}
// interface Y3 implements E1 {}
// interface Y4 implements E1 implements E2 {}
// interface Y5 implements E1 extends E2 {}
// interface Y6 extends E1 implements E2 {}

Commented out lines are reported as errors by TS.

  • Duplicate extends
  • Duplicate implements
  • implements > extends order
  • implements for interface

https://www.typescriptlang.org/play/?#code/MYGwhgzhAECiCM0DeBfAUKSNYCZno3CmgA1EBTADwBdyA7AE20VTQHo3pNiS8rbGzaP3pM4eVtxgkAzNACWAWwAOIcovrUhrDlyLSALApVqNdLXERLV6zdgnoppAKzCaooddN3x+dpycSADZjGzMLBDcBMVw-NHlzcgAnADMwYHJoAE0Kd0FLP10E2lT0zKy+PJjc6PtCzmLktIzsuS9bc210IsTSlqyjdvDPEw6Ih38FXuby1yGfSJF82J0G6bLskKXq0O9O31QgA

The current OXC parser does not report any of these, this PR fixes them to report correctly.

https://playground.oxc.rs/#eNqlkk1vwjAMhv9KljPSBhscet3GlWm7MIlLSF2IlMaVnfAh1P++lNIqKtqE2KWNY7/Pa7s9SS0zqa1iFu9jcapX7hJMzkEXLscCDh5cPihbTtL7/tiIxeOjWCxfBW8x2Fz4LeE+Pg0/9OJnYcrKQgnOD7kvg1Qa3Uifpq0N9X3VbGB08wwrZ5wHKpQG8X21niR334oSwPWabhT+Z4kJZnrvihLG7K+P8TtDjiTK7CQpuObFR+fVQWaeAoykjXyZFcpyDFhjBV2Gj+UabRd5Uo4LpPJSXI9kpYiBGqSyFvef4AO5RfBscpgHp73BaNjKK4JYu4MPReC4vY2Ixv2MiOfeoWV6RRuIrUngydN4GocwjFZ5yN8g/nakGnwkdd1ozGED5wnBqbWFLwykoVRV71YaZwrT+Wl0ntDOY+uNaAe0Ro7Tt8C6/gEuk1d7


First, I tried to raise this error in semantics checker, but it was impossible because parsed AST contains only single superClass and single implements(comma separated).
So I did it in parser.

@graphite-app
Copy link
Contributor

graphite-app bot commented Apr 15, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

@github-actions github-actions bot added A-parser Area - Parser C-bug Category - Bug labels Apr 15, 2025
@leaysgur
Copy link
Member Author

leaysgur commented Apr 15, 2025

Originally this PR is for #9705 , but related coverage test still fails.

This is because TS-ESLint does not report an error for the case interface Y2 extends E1 extends E2 {}. I will open the issue for them later.

@codspeed-hq
Copy link

codspeed-hq bot commented Apr 15, 2025

CodSpeed Instrumentation Performance Report

Merging #10420 will not alter performance

Comparing duplicate-extends_implements (abd6463) with main (dee2db8)

Summary

✅ 36 untouched benchmarks

@Boshen Boshen merged commit f9fd666 into main Apr 15, 2025
29 checks passed
@Boshen Boshen deleted the duplicate-extends_implements branch April 15, 2025 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-parser Area - Parser C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants