From e9a5b2aaeb2a59495c5245cb283d2df7c117796b Mon Sep 17 00:00:00 2001 From: navya9singh <108360753+navya9singh@users.noreply.github.com> Date: Tue, 7 Feb 2023 00:06:04 +0000 Subject: [PATCH] Adding fix for crash and changing test names --- src/compiler/binder.ts | 3 +++ ...> undefinedEntityWithImmediateAndPrototypeAssignments.ts} | 5 +++-- ... undefinedEntityWithImmediateAndPrototypeAssignments1.ts} | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) rename tests/cases/compiler/{undefinedEntityLanguageService.ts => undefinedEntityWithImmediateAndPrototypeAssignments.ts} (68%) rename tests/cases/fourslash/{undefinedEntityLanguageServiceError.ts => undefinedEntityWithImmediateAndPrototypeAssignments1.ts} (85%) diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 5714ec93045..a8547d9b49f 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -3341,6 +3341,9 @@ function createBinder(): (file: SourceFile, options: CompilerOptions) => void { } }); } + if (isPrototypeProperty && namespaceSymbol && namespaceSymbol.valueDeclaration) { + if (isAssignmentDeclaration(namespaceSymbol.valueDeclaration)) containerIsClass = false; + } if (containerIsClass && namespaceSymbol && namespaceSymbol.valueDeclaration) { addDeclarationToSymbol(namespaceSymbol, namespaceSymbol.valueDeclaration, SymbolFlags.Class); } diff --git a/tests/cases/compiler/undefinedEntityLanguageService.ts b/tests/cases/compiler/undefinedEntityWithImmediateAndPrototypeAssignments.ts similarity index 68% rename from tests/cases/compiler/undefinedEntityLanguageService.ts rename to tests/cases/compiler/undefinedEntityWithImmediateAndPrototypeAssignments.ts index 90d3a7b53c6..5d91844c873 100644 --- a/tests/cases/compiler/undefinedEntityLanguageService.ts +++ b/tests/cases/compiler/undefinedEntityWithImmediateAndPrototypeAssignments.ts @@ -1,6 +1,7 @@ -// @filename: a.js +// @noEmit: true // @checkJs: true +// @filename: a.js Thing.abc = 123 Thing.prototype.def = 456 -new Thing(); \ No newline at end of file +new Thing(); diff --git a/tests/cases/fourslash/undefinedEntityLanguageServiceError.ts b/tests/cases/fourslash/undefinedEntityWithImmediateAndPrototypeAssignments1.ts similarity index 85% rename from tests/cases/fourslash/undefinedEntityLanguageServiceError.ts rename to tests/cases/fourslash/undefinedEntityWithImmediateAndPrototypeAssignments1.ts index f4f68ceb97d..2bc5950f12c 100644 --- a/tests/cases/fourslash/undefinedEntityLanguageServiceError.ts +++ b/tests/cases/fourslash/undefinedEntityWithImmediateAndPrototypeAssignments1.ts @@ -1,11 +1,11 @@ /// -// @Filename: a.js // @allowJs: true +// @Filename: a.js //// Thing.abc = 123 //// Thing.prototype.def = 456 //// new Thing/**/(); verify.goToDefinition("", ""); -verify.noErrors(); \ No newline at end of file +verify.noErrors();