From 5ccfa34c20c40ce5f42f8e71ec86e79b25212b2c Mon Sep 17 00:00:00 2001 From: David Sherret Date: Mon, 9 Oct 2023 19:31:54 +0900 Subject: [PATCH] fix(type_tracing): range for default decl should be the decl range (#301) --- src/type_tracer/analyzer.rs | 2 +- tests/specs/type_tracing/Basic.txt | 4 ++-- tests/specs/type_tracing/ExportDefault01.txt | 16 ++++++++-------- tests/specs/type_tracing/ExportStar01.txt | 16 ++++++++-------- tests/specs/type_tracing/ImportType02.txt | 4 ++-- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/type_tracer/analyzer.rs b/src/type_tracer/analyzer.rs index a9b2a6c2d..096224d3e 100644 --- a/src/type_tracer/analyzer.rs +++ b/src/type_tracer/analyzer.rs @@ -1074,7 +1074,7 @@ impl<'a, THandler: TypeTraceHandler> SymbolFiller<'a, THandler> { id.clone(), SymbolDecl { kind: SymbolDeclKind::Definition, - range: ident.range(), + range: default_decl.decl.range(), }, ); file_module diff --git a/tests/specs/type_tracing/Basic.txt b/tests/specs/type_tracing/Basic.txt index cc29c0439..1470f4471 100644 --- a/tests/specs/type_tracing/Basic.txt +++ b/tests/specs/type_tracing/Basic.txt @@ -404,10 +404,10 @@ file:///a.ts: EsmModuleSymbol { SymbolDecl { range: SourceRange { start: SourcePos( - 165, + 159, ), end: SourcePos( - 166, + 170, ), }, kind: Definition, diff --git a/tests/specs/type_tracing/ExportDefault01.txt b/tests/specs/type_tracing/ExportDefault01.txt index a96a81576..8af597f7b 100644 --- a/tests/specs/type_tracing/ExportDefault01.txt +++ b/tests/specs/type_tracing/ExportDefault01.txt @@ -435,10 +435,10 @@ file:///a.ts: EsmModuleSymbol { SymbolDecl { range: SourceRange { start: SourcePos( - 161, + 155, ), end: SourcePos( - 165, + 182, ), }, kind: Definition, @@ -582,10 +582,10 @@ file:///interface.ts: EsmModuleSymbol { SymbolDecl { range: SourceRange { start: SourcePos( - 25, + 15, ), end: SourcePos( - 29, + 33, ), }, kind: Definition, @@ -662,10 +662,10 @@ file:///function.ts: EsmModuleSymbol { SymbolDecl { range: SourceRange { start: SourcePos( - 24, + 15, ), end: SourcePos( - 28, + 34, ), }, kind: Definition, @@ -735,10 +735,10 @@ file:///class.ts: EsmModuleSymbol { SymbolDecl { range: SourceRange { start: SourcePos( - 21, + 15, ), end: SourcePos( - 25, + 29, ), }, kind: Definition, diff --git a/tests/specs/type_tracing/ExportStar01.txt b/tests/specs/type_tracing/ExportStar01.txt index c6373a48a..4881db4ed 100644 --- a/tests/specs/type_tracing/ExportStar01.txt +++ b/tests/specs/type_tracing/ExportStar01.txt @@ -217,10 +217,10 @@ file:///a.ts: EsmModuleSymbol { SymbolDecl { range: SourceRange { start: SourcePos( - 161, + 155, ), end: SourcePos( - 165, + 182, ), }, kind: Definition, @@ -357,10 +357,10 @@ file:///class.ts: EsmModuleSymbol { SymbolDecl { range: SourceRange { start: SourcePos( - 21, + 15, ), end: SourcePos( - 25, + 29, ), }, kind: Definition, @@ -430,10 +430,10 @@ file:///function.ts: EsmModuleSymbol { SymbolDecl { range: SourceRange { start: SourcePos( - 24, + 15, ), end: SourcePos( - 28, + 34, ), }, kind: Definition, @@ -503,10 +503,10 @@ file:///interface.ts: EsmModuleSymbol { SymbolDecl { range: SourceRange { start: SourcePos( - 25, + 15, ), end: SourcePos( - 29, + 33, ), }, kind: Definition, diff --git a/tests/specs/type_tracing/ImportType02.txt b/tests/specs/type_tracing/ImportType02.txt index f088bbb36..7a76fabc6 100644 --- a/tests/specs/type_tracing/ImportType02.txt +++ b/tests/specs/type_tracing/ImportType02.txt @@ -147,10 +147,10 @@ file:///a.ts: EsmModuleSymbol { SymbolDecl { range: SourceRange { start: SourcePos( - 141, + 132, ), end: SourcePos( - 145, + 151, ), }, kind: Definition,