Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions test/SourceKit/CodeComplete/complete_structure.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
// RUN: %complete-test %s -group=none -fuzz -structure -tok=OVERRIDE_0 | FileCheck %s -check-prefix=OVERRIDE_0
// RUN: %complete-test %s -group=none -fuzz -structure -tok=S1_INNER_0 | FileCheck %s -check-prefix=S1_INNER_0
// RUN: %complete-test %s -group=none -fuzz -structure -tok=INT_INNER_0 | FileCheck %s -check-prefix=INT_INNER_0
// RUN: %complete-test %s -group=none -fuzz -structure -tok=ASSOCIATED_TYPE_1 | FileCheck %s -check-prefix=ASSOCIATED_TYPE_1

struct S1 {
func method1() {}
Expand Down Expand Up @@ -119,3 +120,11 @@ func test9(_ x: inout Int) {
// INT_INNER_0: {name:x++}
// INT_INNER_0: {name:x>>}
// INT_INNER_0: {name:x..<}

protocol P1 {
associatedtype T
}
struct S2: P1 {
#^ASSOCIATED_TYPE_1^#
}
// ASSOCIATED_TYPE_1: {name:T = }{params:{l:Type}}
2 changes: 1 addition & 1 deletion tools/SourceKit/lib/SwiftLang/SwiftCompletion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ static void getResultStructure(
if (!param.range().empty())
parameters.push_back(std::move(param));

if (chunks[i].hasText())
if (i < chunks.size() && chunks[i].hasText())
textSize += chunks[i].getText().size();
}

Expand Down