File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed
test/SourceKit/CursorInfo Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -5101,6 +5101,14 @@ ParamDecl::getDefaultValueStringRepresentation(
5101
5101
auto existing = DefaultValueAndFlags.getPointer ()->StringRepresentation ;
5102
5102
if (!existing.empty ())
5103
5103
return existing;
5104
+
5105
+ if (!getDefaultValue ()) {
5106
+ // TypeChecker::checkDefaultArguments() nulls out the default value
5107
+ // if it fails to type check it. This only seems to happen with an
5108
+ // invalid/incomplete parameter list that contains a parameter with an
5109
+ // unresolved default value.
5110
+ return " <<empty>>" ;
5111
+ }
5104
5112
return extractInlinableText (getASTContext ().SourceMgr , getDefaultValue (),
5105
5113
scratch);
5106
5114
}
Original file line number Diff line number Diff line change
1
+ enum LogLevel { case error }
2
+
3
+ func logAsync( level: LogLevel = undefined, messageProducer producer
4
+
5
+ // RUN: %sourcekitd-test -req=cursor -pos=3:44 %s -- %s | %FileCheck %s
6
+
7
+ // CHECK: source.lang.swift.decl.function.free (3:6-3:68)
8
+ // CHECK: logAsync(level:messageProducer:)
9
+ // CHECK: LogLevel</Type> = <<empty>>
You can’t perform that action at this time.
0 commit comments