diff --git a/lib/AST/NameLookup.cpp b/lib/AST/NameLookup.cpp index 145e623a531b7..25e56a9411192 100644 --- a/lib/AST/NameLookup.cpp +++ b/lib/AST/NameLookup.cpp @@ -3050,7 +3050,8 @@ createOpaqueParameterGenericParams(GenericContext *genericContext, GenericParamL // Allocate a new generic parameter to represent this opaque type. auto *gp = GenericTypeParamDecl::createImplicit( dc, Identifier(), GenericTypeParamDecl::InvalidDepth, index++, - /*isParameterPack*/ false, /*isOpaqueType*/ true, repr); + /*isParameterPack*/ false, /*isOpaqueType*/ true, repr, + /*nameLoc*/ repr->getStartLoc()); // Use the underlying constraint as the constraint on the generic parameter. // The underlying constraint is only present for OpaqueReturnTypeReprs diff --git a/test/SymbolGraph/Symbols/OpaqueParams.swift b/test/SymbolGraph/Symbols/OpaqueParams.swift new file mode 100644 index 0000000000000..8c326eec8a0b2 --- /dev/null +++ b/test/SymbolGraph/Symbols/OpaqueParams.swift @@ -0,0 +1,15 @@ +// RUN: %empty-directory(%t) +// RUN: %target-swift-frontend -swift-version 5 %s -emit-module -emit-module-path %t/OpaqueParams.swiftmodule -emit-symbol-graph -emit-symbol-graph-dir %t/ +// RUN: %{python} -m json.tool %t/OpaqueParams.symbols.json %t/OpaqueParams.formatted.symbols.json +// RUN: %FileCheck %s --input-file %t/OpaqueParams.formatted.symbols.json + +// CHECK: "precise": "s:12OpaqueParams7MyClassC6myFunc5param10otherParamyq__xtAA0C8ProtocolRzAaGR_r0_lF" + +public protocol MyProtocol {} + +public class MyClass { + public func myFunc( + param: some MyProtocol, + otherParam: S + ) {} +}