mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Index] Fix extension type location
The end loc is wrong when generic args are present, just use `getLoc` which uses the name loc.
This commit is contained in:
@@ -103,12 +103,8 @@ static bool isMemberwiseInit(swift::ValueDecl *D) {
|
||||
}
|
||||
|
||||
static SourceLoc getLocForExtension(ExtensionDecl *D) {
|
||||
// Use the 'End' token of the range, in case it is a compound name, e.g.
|
||||
// extension A.B {}
|
||||
// we want the location of 'B' token.
|
||||
if (auto *repr = D->getExtendedTypeRepr()) {
|
||||
return repr->getSourceRange().End;
|
||||
}
|
||||
if (auto *repr = D->getExtendedTypeRepr())
|
||||
return repr->getLoc();
|
||||
return SourceLoc();
|
||||
}
|
||||
|
||||
|
||||
@@ -92,9 +92,8 @@ extension IntArray {
|
||||
func flam() {}
|
||||
}
|
||||
|
||||
// FIXME: Column 22 here is wrong...
|
||||
extension ArrayOf<Int> {
|
||||
// CHECK: [[@LINE-1]]:22 | extension/ext-struct/Swift | Array | s:e:s:Sa14swift_ide_testSiRszlE4bishyyF | Def | rel: 0
|
||||
// CHECK: [[@LINE-1]]:11 | extension/ext-struct/Swift | Array | s:e:s:Sa14swift_ide_testSiRszlE4bishyyF | Def | rel: 0
|
||||
// CHECK-NEXT: [[@LINE-2]]:11 | type-alias/Swift | ArrayOf | s:3Lib7ArrayOfa | Ref | rel: 0
|
||||
// CHECK-NEXT: [[@LINE-3]]:11 | struct/Swift | Array | s:Sa | Ref,Impl,RelExt | rel: 1
|
||||
// CHECK-NEXT: RelExt | extension/ext-struct/Swift | Array | s:e:s:Sa14swift_ide_testSiRszlE4bishyyF
|
||||
|
||||
@@ -565,9 +565,8 @@ class Subclass: BaseClass {
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: Column 15 here is wrong...
|
||||
extension [Int] {
|
||||
// CHECK: [[@LINE-1]]:15 | extension/ext-struct/Swift | Array | s:e:s:Sa14swift_ide_testSiRszlE3fooyyF | Def | rel: 0
|
||||
// CHECK: [[@LINE-1]]:11 | extension/ext-struct/Swift | Array | s:e:s:Sa14swift_ide_testSiRszlE3fooyyF | Def | rel: 0
|
||||
// CHECK-NEXT: [[@LINE-2]]:11 | struct/Swift | Array | s:Sa | Ref,Impl,RelExt | rel: 1
|
||||
// CHECK-NEXT: RelExt | extension/ext-struct/Swift | Array | s:e:s:Sa14swift_ide_testSiRszlE3fooyyF
|
||||
// CHECK-NEXT: [[@LINE-4]]:12 | struct/Swift | Int | s:Si | Ref | rel: 0
|
||||
@@ -602,9 +601,8 @@ extension IntArray {
|
||||
func flam() {}
|
||||
}
|
||||
|
||||
// FIXME: Column 22 here is wrong...
|
||||
extension ArrayOf<Int> {
|
||||
// CHECK: [[@LINE-1]]:22 | extension/ext-struct/Swift | Array | s:e:s:Sa14swift_ide_testSiRszlE4bishyyF | Def | rel: 0
|
||||
// CHECK: [[@LINE-1]]:11 | extension/ext-struct/Swift | Array | s:e:s:Sa14swift_ide_testSiRszlE4bishyyF | Def | rel: 0
|
||||
// CHECK-NEXT: [[@LINE-2]]:11 | type-alias/Swift | ArrayOf | s:14swift_ide_test7ArrayOfa | Ref | rel: 0
|
||||
// CHECK-NEXT: [[@LINE-3]]:11 | struct/Swift | Array | s:Sa | Ref,Impl,RelExt | rel: 1
|
||||
// CHECK-NEXT: RelExt | extension/ext-struct/Swift | Array | s:e:s:Sa14swift_ide_testSiRszlE4bishyyF
|
||||
|
||||
Reference in New Issue
Block a user