Skip to content

Commit 7b0d1a4

Browse files
add a source location for GenericTypeParamDecls (#64722)
rdar://105982860
1 parent 3425206 commit 7b0d1a4

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

lib/AST/NameLookup.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3050,7 +3050,8 @@ createOpaqueParameterGenericParams(GenericContext *genericContext, GenericParamL
30503050
// Allocate a new generic parameter to represent this opaque type.
30513051
auto *gp = GenericTypeParamDecl::createImplicit(
30523052
dc, Identifier(), GenericTypeParamDecl::InvalidDepth, index++,
3053-
/*isParameterPack*/ false, /*isOpaqueType*/ true, repr);
3053+
/*isParameterPack*/ false, /*isOpaqueType*/ true, repr,
3054+
/*nameLoc*/ repr->getStartLoc());
30543055

30553056
// Use the underlying constraint as the constraint on the generic parameter.
30563057
// The underlying constraint is only present for OpaqueReturnTypeReprs
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-swift-frontend -swift-version 5 %s -emit-module -emit-module-path %t/OpaqueParams.swiftmodule -emit-symbol-graph -emit-symbol-graph-dir %t/
3+
// RUN: %{python} -m json.tool %t/OpaqueParams.symbols.json %t/OpaqueParams.formatted.symbols.json
4+
// RUN: %FileCheck %s --input-file %t/OpaqueParams.formatted.symbols.json
5+
6+
// CHECK: "precise": "s:12OpaqueParams7MyClassC6myFunc5param10otherParamyq__xtAA0C8ProtocolRzAaGR_r0_lF"
7+
8+
public protocol MyProtocol {}
9+
10+
public class MyClass {
11+
public func myFunc<S: MyProtocol>(
12+
param: some MyProtocol,
13+
otherParam: S
14+
) {}
15+
}

0 commit comments

Comments
 (0)