@@ -708,20 +708,24 @@ impl Handler for PreferPrimordialsHandler {
708708 fn bin_expr ( & mut self , bin_expr : & ast_view:: BinExpr , ctx : & mut Context ) {
709709 use ast_view:: BinaryOp ;
710710
711- if matches ! ( bin_expr. op( ) , BinaryOp :: InstanceOf ) {
712- ctx. add_diagnostic_with_hint (
713- bin_expr. range ( ) ,
714- CODE ,
715- PreferPrimordialsMessage :: InstanceOf ,
716- PreferPrimordialsHint :: InstanceOf ,
717- ) ;
718- } else if matches ! ( bin_expr. op( ) , BinaryOp :: In ) {
719- ctx. add_diagnostic_with_hint (
720- bin_expr. range ( ) ,
721- CODE ,
722- PreferPrimordialsMessage :: In ,
723- PreferPrimordialsHint :: In ,
724- ) ;
711+ match bin_expr. op ( ) {
712+ BinaryOp :: InstanceOf => {
713+ ctx. add_diagnostic_with_hint (
714+ bin_expr. range ( ) ,
715+ CODE ,
716+ PreferPrimordialsMessage :: InstanceOf ,
717+ PreferPrimordialsHint :: InstanceOf ,
718+ ) ;
719+ }
720+ BinaryOp :: In if !bin_expr. left . is :: < ast_view:: PrivateName > ( ) => {
721+ ctx. add_diagnostic_with_hint (
722+ bin_expr. range ( ) ,
723+ CODE ,
724+ PreferPrimordialsMessage :: In ,
725+ PreferPrimordialsHint :: In ,
726+ ) ;
727+ }
728+ _ => { }
725729 }
726730 }
727731}
@@ -908,6 +912,15 @@ function foo(): Array<any> {}
908912 r#"
909913type p = Promise<void>;
910914 "# ,
915+ r#"
916+ class A {
917+ #brand;
918+
919+ static is(obj) {
920+ return #brand in obj;
921+ }
922+ }
923+ "# ,
911924 } ;
912925 }
913926
@@ -1289,6 +1302,13 @@ new DataView(new ArrayBuffer(10)).byteOffset;
12891302 hint: PreferPrimordialsHint :: In ,
12901303 } ,
12911304 ] ,
1305+ r#"a in A"# : [
1306+ {
1307+ col: 0 ,
1308+ message: PreferPrimordialsMessage :: In ,
1309+ hint: PreferPrimordialsHint :: In ,
1310+ } ,
1311+ ] ,
12921312 r#"a instanceof A"# : [
12931313 {
12941314 col: 0 ,
0 commit comments