js2-mode icon indicating copy to clipboard operation
js2-mode copied to clipboard

"Property 'x' already defined" for static and instance class functions/fields and 'use strict'

Open jacott opened this issue 6 years ago • 2 comments

Similar to issue #264 static and instance functions with the same name are being confused for the same property. . The error message is only shown in strict mode.

For example, given the following code in a js2-mode buffer:

'use strict';

class A {
  static x() { }
  x() { }

  static y = 1;
  y  = 2;
}

The x in x() { } will be highlighted red, and it will show the message:

Property 'x' already defined in this object literal. Same is true for y

jacott avatar Sep 07 '19 22:09 jacott

Is this resolved? (I cannot reproduce it)

ArneBab avatar Apr 28 '21 10:04 ArneBab

Still reproduces here.

dgutov avatar Apr 28 '21 10:04 dgutov