From 0940d3bb3b923615568f5cc56d876b4a6576cf79 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Thu, 22 Jan 2015 17:16:18 -0800 Subject: [PATCH] handle union properties in when doing getOccurences\findAllReferences --- src/services/services.ts | 3 ++- tests/cases/fourslash/scopeOfUnionProperties.ts | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 tests/cases/fourslash/scopeOfUnionProperties.ts diff --git a/src/services/services.ts b/src/services/services.ts index 84e5e7fefa5..d56c2c29639 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -3903,7 +3903,8 @@ module ts { } // if this symbol is visible from its parent container, e.g. exported, then bail out - if (symbol.parent) { + // if symbol correspond to the union property - bail out + if (symbol.parent || (symbol.getFlags() & SymbolFlags.UnionProperty)) { return undefined; } diff --git a/tests/cases/fourslash/scopeOfUnionProperties.ts b/tests/cases/fourslash/scopeOfUnionProperties.ts new file mode 100644 index 00000000000..ec2fe3a9ac5 --- /dev/null +++ b/tests/cases/fourslash/scopeOfUnionProperties.ts @@ -0,0 +1,7 @@ +/// + +////function f(s: string | number) { +//// s.constr/*1*/uctor +////} +goTo.marker("1") +verify.occurrencesAtPositionCount(1);