[sourcekitd][AST] Fix CursorInfo crash on method with unresolved default value

When printing its annotated decl, we would would assume the param's default
value is present if the default value kind was "Normal". The type checker
explicitly sets the default value to nullptr if it doesn't type check though, so
we were crashing for that case. Added the check.

Resolves rdar://problem/46694149
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index d30d070c..014d870 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -5101,6 +5101,14 @@
     auto existing = DefaultValueAndFlags.getPointer()->StringRepresentation;
     if (!existing.empty())
       return existing;
+
+    if (!getDefaultValue()) {
+      // TypeChecker::checkDefaultArguments() nulls out the default value
+      // if it fails to type check it. This only seems to happen with an
+      // invalid/incomplete parameter list that contains a parameter with an
+      // unresolved default value.
+      return "<<empty>>";
+    }
     return extractInlinableText(getASTContext().SourceMgr, getDefaultValue(),
                                 scratch);
   }
diff --git a/test/SourceKit/CursorInfo/undefined-default-value.swift b/test/SourceKit/CursorInfo/undefined-default-value.swift
new file mode 100644
index 0000000..9dde0d1
--- /dev/null
+++ b/test/SourceKit/CursorInfo/undefined-default-value.swift
@@ -0,0 +1,9 @@
+enum LogLevel { case error }
+
+func logAsync(level: LogLevel = undefined, messageProducer producer
+
+// RUN: %sourcekitd-test -req=cursor -pos=3:44 %s -- %s | %FileCheck %s
+
+// CHECK: source.lang.swift.decl.function.free (3:6-3:68)
+// CHECK: logAsync(level:messageProducer:)
+// CHECK: LogLevel</Type> = &lt;&lt;empty&gt;&gt