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
2 changes: 1 addition & 1 deletion lib/AST/ASTPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4216,7 +4216,7 @@ class TypePrinter : public TypeVisitor<TypePrinter> {
void visitOpaqueTypeArchetypeType(OpaqueTypeArchetypeType *T) {
switch (Options.OpaqueReturnTypePrinting) {
case PrintOptions::OpaqueReturnTypePrintingMode::WithOpaqueKeyword:
Printer << "some ";
Printer.printKeyword("some", Options, /*Suffix=*/" ");
LLVM_FALLTHROUGH;
case PrintOptions::OpaqueReturnTypePrintingMode::WithoutOpaqueKeyword: {
visit(T->getExistentialType());
Expand Down
2 changes: 1 addition & 1 deletion lib/AST/TypeRepr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ void ProtocolTypeRepr::printImpl(ASTPrinter &Printer,

void OpaqueReturnTypeRepr::printImpl(ASTPrinter &Printer,
const PrintOptions &Opts) const {
Printer << "some ";
Printer.printKeyword("some", Opts, /*Suffix=*/" ");
printTypeRepr(Constraint, Printer, Opts);
}

Expand Down
12 changes: 12 additions & 0 deletions test/SourceKit/CursorInfo/cursor_some_type.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
public class Base {}

public protocol Proto {}

public func foo() -> some Base & Proto {
class Derived: Base, Proto {}
return Derived()
}

// RUN: %sourcekitd-test -req=cursor -pos=5:13 %s -- %s | %FileCheck %s
// CHECK: <Declaration>public func foo() -&gt; some <Type usr=[[Base_USR:.*]]>Base</Type> &amp; <Type usr=[[Proto_USR:.*]]>Proto</Type></Declaration>
// CHECK: <decl.function.free><syntaxtype.keyword>public</syntaxtype.keyword> <syntaxtype.keyword>func</syntaxtype.keyword> <decl.name>foo</decl.name>() -&gt; <decl.function.returntype><syntaxtype.keyword>some</syntaxtype.keyword> <ref.class usr=[[Base_USR]]>Base</ref.class> &amp; <ref.protocol usr=[[Proto_USR]]>Proto</ref.protocol></decl.function.returntype></decl.function.free>