1/* 2* Copyright (c) Microsoft Corporation. All rights reserved. 3* Copyright (c) 2023 Huawei Device Co., Ltd. 4* Licensed under the Apache License, Version 2.0 (the "License"); 5* you may not use this file except in compliance with the License. 6* You may obtain a copy of the License at 7* 8* http://www.apache.org/licenses/LICENSE-2.0 9* 10* Unless required by applicable law or agreed to in writing, software 11* distributed under the License is distributed on an "AS IS" BASIS, 12* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13* See the License for the specific language governing permissions and 14* limitations under the License. 15* 16* This file has been modified by Huawei to verify type inference by adding verification statements. 17*/ 18 19// === tests/cases/conformance/types/objectTypeLiteral/propertySignatures/propertyNamesOfReservedWords.ts === 20declare function AssertType(value:any, type:string):void; 21class C { 22 abstract; 23 as; 24 boolean; 25 break; 26 byte; 27 case; 28 catch; 29 char; 30 class; 31 continue; 32 const; 33 debugger; 34 default; 35 delete; 36 do; 37 double; 38 else; 39 enum; 40 export; 41 extends; 42 false; 43 final; 44 finally; 45 float; 46 for; 47 function; 48 goto; 49 if; 50 implements; 51 import; 52 in; 53 instanceof; 54 int; 55 interface; 56 is; 57 long; 58 namespace; 59 native; 60 new; 61 null; 62 package; 63 private; 64 protected; 65 public; 66 return; 67 short; 68 static; 69 super; 70 switch; 71 synchronized; 72 this; 73 throw; 74 throws; 75 transient; 76 true; 77 try; 78 typeof; 79 use; 80 let; 81 void; 82 volatile; 83 while; 84 with; 85} 86let c: C; 87AssertType(c, "C"); 88 89let r1 = c.abstract; 90AssertType(r1, "any"); 91AssertType(c.abstract, "any"); 92 93let r2 = c.as; 94AssertType(r2, "any"); 95AssertType(c.as, "any"); 96 97interface I { 98 abstract; 99 as; 100 boolean; 101 break; 102 byte; 103 case; 104 catch; 105 char; 106 class; 107 continue; 108 const; 109 debugger; 110 default; 111 delete; 112 do; 113 double; 114 else; 115 enum; 116 export; 117 extends; 118 false; 119 final; 120 finally; 121 float; 122 for; 123 function; 124 goto; 125 if; 126 implements; 127 import; 128 in; 129 instanceof; 130 int; 131 interface; 132 is; 133 long; 134 namespace; 135 native; 136 new; 137 null; 138 package; 139 private; 140 protected; 141 public; 142 return; 143 short; 144 static; 145 super; 146 switch; 147 synchronized; 148 this; 149 throw; 150 throws; 151 transient; 152 true; 153 try; 154 typeof; 155 use; 156 let; 157 void; 158 volatile; 159 while; 160 with; 161} 162 163let i: I; 164AssertType(i, "I"); 165 166let r3 = i.abstract; 167AssertType(r3, "any"); 168AssertType(i.abstract, "any"); 169 170let r4 = i.as; 171AssertType(r4, "any"); 172AssertType(i.as, "any"); 173 174let a: { 175AssertType(a, "{ abstract: any; as: any; boolean: any; break: any; byte: any; case: any; catch: any; char: any; class: any; continue: any; const: any; debugger: any; default: any; delete: any; do: any; double: any; else: any; enum: any; export: any; extends: any; false: any; final: any; finally: any; float: any; for: any; function: any; goto: any; if: any; implements: any; import: any; in: any; instanceof: any; int: any; interface: any; is: any; long: any; namespace: any; native: any; new: any; null: any; package: any; private: any; protected: any; public: any; return: any; short: any; static: any; super: any; switch: any; synchronized: any; this: any; throw: any; throws: any; transient: any; true: any; try: any; typeof: any; use: any; let: any; void: any; volatile: any; while: any; with: any; }"); 176 177 abstract; 178AssertType(abstract, "any"); 179 180 as; 181AssertType(as, "any"); 182 183 boolean; 184AssertType(boolean, "any"); 185 186 break; 187AssertType(break, "any"); 188 189 byte; 190AssertType(byte, "any"); 191 192 case; 193AssertType(case, "any"); 194 195 catch; 196AssertType(catch, "any"); 197 198 char; 199AssertType(char, "any"); 200 201 class; 202AssertType(class, "any"); 203 204 continue; 205AssertType(continue, "any"); 206 207 const; 208AssertType(const, "any"); 209 210 debugger; 211AssertType(debugger, "any"); 212 213 default; 214AssertType(default, "any"); 215 216 delete; 217AssertType(delete, "any"); 218 219 do; 220AssertType(do, "any"); 221 222 double; 223AssertType(double, "any"); 224 225 else; 226AssertType(else, "any"); 227 228 enum; 229AssertType(enum, "any"); 230 231 export; 232AssertType(export, "any"); 233 234 extends; 235AssertType(extends, "any"); 236 237 false; 238AssertType(false, "any"); 239 240 final; 241AssertType(final, "any"); 242 243 finally; 244AssertType(finally, "any"); 245 246 float; 247AssertType(float, "any"); 248 249 for; 250AssertType(for, "any"); 251 252 function; 253AssertType(function, "any"); 254 255 goto; 256AssertType(goto, "any"); 257 258 if; 259AssertType(if, "any"); 260 261 implements; 262AssertType(implements, "any"); 263 264 import; 265AssertType(import, "any"); 266 267 in; 268AssertType(in, "any"); 269 270 instanceof; 271AssertType(instanceof, "any"); 272 273 int; 274AssertType(int, "any"); 275 276 interface; 277AssertType(interface, "any"); 278 279 is; 280AssertType(is, "any"); 281 282 long; 283AssertType(long, "any"); 284 285 namespace; 286AssertType(namespace, "any"); 287 288 native; 289AssertType(native, "any"); 290 291 new; 292 null; 293AssertType(null, "any"); 294 295 package; 296AssertType(package, "any"); 297 298 private; 299AssertType(private, "any"); 300 301 protected; 302AssertType(protected, "any"); 303 304 public; 305AssertType(public, "any"); 306 307AssertType(return, "any"); 308 return; 309 310 short; 311AssertType(short, "any"); 312 313 static; 314AssertType(static, "any"); 315 316 super; 317AssertType(super, "any"); 318 319 switch; 320AssertType(switch, "any"); 321 322 synchronized; 323AssertType(synchronized, "any"); 324 325 this; 326AssertType(this, "any"); 327 328 throw; 329AssertType(throw, "any"); 330 331 throws; 332AssertType(throws, "any"); 333 334 transient; 335AssertType(transient, "any"); 336 337 true; 338AssertType(true, "any"); 339 340 try; 341AssertType(try, "any"); 342 343 typeof; 344AssertType(typeof, "any"); 345 346 use; 347AssertType(use, "any"); 348 349 let; 350AssertType(let, "any"); 351 352 void; 353AssertType(void, "any"); 354 355 volatile; 356AssertType(volatile, "any"); 357 358 while; 359AssertType(while, "any"); 360 361 with; 362AssertType(with, "any"); 363} 364 365let r5 = a.abstract; 366AssertType(r5, "any"); 367AssertType(a.abstract, "any"); 368 369let r6 = a.as; 370AssertType(r6, "any"); 371AssertType(a.as, "any"); 372 373enum E { 374 abstract, 375 as, 376 boolean, 377 break, 378 byte, 379 case, 380 catch, 381 char, 382 class, 383 continue, 384 const, 385 debugger, 386 default, 387 delete, 388 do, 389 double, 390 else, 391 enum, 392 export, 393 extends, 394 false, 395 final, 396 finally, 397 float, 398 for, 399 function, 400 goto, 401 if, 402 implements, 403 import, 404 in, 405 instanceof, 406 int, 407 interface, 408 is, 409 long, 410 namespace, 411 native, 412 new, 413 null, 414 package, 415 private, 416 protected, 417 public, 418 return, 419 short, 420 static, 421 super, 422 switch, 423 synchronized, 424 this, 425 throw, 426 throws, 427 transient, 428 true, 429 try, 430 typeof, 431 use, 432 let, 433 void, 434 volatile, 435 while, 436 with, 437} 438 439let r7 = E.abstract; 440AssertType(r7, "E"); 441AssertType(E.abstract, "E.abstract"); 442 443let r8 = E.as; 444AssertType(r8, "E"); 445AssertType(E.as, "E.as"); 446 447 448