@@ -694,7 +694,6 @@ getParamParentNameOffset(const ValueDecl *VD, SourceLoc Cursor) {
694
694
static bool passCursorInfoForDecl (SourceFile* SF,
695
695
const ValueDecl *VD,
696
696
const ModuleDecl *MainModule,
697
- const Type Ty,
698
697
const Type ContainerTy,
699
698
bool IsRef,
700
699
bool RetrieveRefactoring,
@@ -710,7 +709,7 @@ static bool passCursorInfoForDecl(SourceFile* SF,
710
709
return true ;
711
710
712
711
SmallString<64 > SS;
713
- auto BaseType = findBaseTypeForReplacingArchetype (VD, Ty );
712
+ auto BaseType = findBaseTypeForReplacingArchetype (VD, ContainerTy );
714
713
bool InSynthesizedExtension = false ;
715
714
if (BaseType) {
716
715
if (auto Target = BaseType->getAnyNominal ()) {
@@ -1293,11 +1292,17 @@ static void resolveCursor(SwiftLangSupport &Lang,
1293
1292
CompInvok, Receiver);
1294
1293
return ;
1295
1294
case CursorInfoKind::ValueRef: {
1296
- ValueDecl *VD = CursorInfo.CtorTyRef ? CursorInfo.CtorTyRef : CursorInfo.ValueD ;
1295
+ ValueDecl *VD = CursorInfo.ValueD ;
1296
+ Type ContainerType = CursorInfo.ContainerType ;
1297
+ if (CursorInfo.CtorTyRef ) {
1298
+ // Treat constructor calls, e.g. MyType(), as the type itself,
1299
+ // rather than its constructor.
1300
+ VD = CursorInfo.CtorTyRef ;
1301
+ ContainerType = Type ();
1302
+ }
1297
1303
bool Failed = passCursorInfoForDecl (&AstUnit->getPrimarySourceFile (),
1298
1304
VD, MainModule,
1299
- CursorInfo.ContainerType ,
1300
- CursorInfo.ContainerType ,
1305
+ ContainerType,
1301
1306
CursorInfo.IsRef ,
1302
1307
Actionables,
1303
1308
CursorInfo,
@@ -1589,7 +1594,7 @@ void SwiftLangSupport::getCursorInfo(
1589
1594
// FIXME: Should pass the main module for the interface but currently
1590
1595
// it's not necessary.
1591
1596
passCursorInfoForDecl (
1592
- /* SourceFile*/ nullptr , Entity.Dcl , /* MainModule*/ nullptr , Type (),
1597
+ /* SourceFile*/ nullptr , Entity.Dcl , /* MainModule*/ nullptr ,
1593
1598
Type (), Entity.IsRef , Actionables, ResolvedCursorInfo (),
1594
1599
/* OrigBufferID=*/ None, SourceLoc (),
1595
1600
{}, *this , Invok, {}, Receiver);
@@ -1780,7 +1785,7 @@ resolveCursorFromUSR(SwiftLangSupport &Lang, StringRef InputFile, StringRef USR,
1780
1785
}
1781
1786
bool Failed =
1782
1787
passCursorInfoForDecl (/* SourceFile*/ nullptr , VD, MainModule, selfTy,
1783
- Type (), /* IsRef=*/ false , false , ResolvedCursorInfo (),
1788
+ /* IsRef=*/ false , false , ResolvedCursorInfo (),
1784
1789
BufferID, SourceLoc (), {}, Lang, CompInvok,
1785
1790
PreviousASTSnaps, Receiver);
1786
1791
if (Failed) {
0 commit comments