-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Mangler] Handle local archetypes in getDeclTypeForMangling
#78855
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// https://github.com/swiftlang/swift/issues/78690 | ||
// rdar://143077965 | ||
|
||
protocol P { | ||
associatedtype R | ||
} | ||
|
||
func foo<each T>(_ xs: repeat each T) { | ||
for x in repeat each xs { | ||
// RUN: %sourcekitd-test -req=cursor -pos=%(line-1):7 %s -- %s | %FileCheck %s --check-prefix=BASIC | ||
// BASIC: s:4main3fooyyxxQpRvzlF1xL_qd__vp | ||
for x2 in repeat each xs { | ||
// RUN: %sourcekitd-test -req=cursor -pos=%(line-1):9 %s -- %s | %FileCheck %s --check-prefix=NESTED | ||
// NESTED: s:4main3fooyyxxQpRvzlF2x2L_qd__vp | ||
} | ||
} | ||
} | ||
|
||
func bar<each T, each U>(xs: repeat each T, ys: repeat each U) { | ||
for x1 in repeat each xs { | ||
for y1 in repeat each ys { | ||
func localFn() { | ||
for x2 in repeat each xs { | ||
for y2 in repeat each ys { | ||
let k = (x1, y1, x2, y2) | ||
// RUN: %sourcekitd-test -req=cursor -pos=%(line-1):17 %s -- %s | %FileCheck %s --check-prefix=DOUBLENESTED | ||
// DOUBLENESTED: s:4main3bar2xs2ysyxxQp_q_q_QptRvzRv_r0_lF7localFnL_yyRvzRv_r0_lF1kL_qd___qd0__qd1__qd2__tvp | ||
// -> (A1, A2, A3, A4) | ||
} | ||
} | ||
} | ||
_ = { | ||
for x2 in repeat each xs { | ||
for y2 in repeat each ys { | ||
let k = (x1, y1, x2, y2) | ||
// RUN: %sourcekitd-test -req=cursor -pos=%(line-1):17 %s -- %s | %FileCheck %s --check-prefix=DOUBLENESTED-CLOSURE | ||
// DOUBLENESTED-CLOSURE: s:4main3bar2xs2ysyxxQp_q_q_QptRvzRv_r0_lFyycfU_1kL_qd___qd0__qd1__qd2__tvp | ||
// -> (A1, A2, A3, A4) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
func baz<each T, each U, each V>( | ||
ts: repeat each T, us: repeat each U, urs: repeat (each U).R, vs: repeat each V | ||
) where repeat each U: P, (repeat (each U, each V)): Any { | ||
for t in repeat each ts { | ||
func localFn() { | ||
for y in repeat each us { | ||
func genericLocalFn<A>(_ a: A) { | ||
for (u, ur, v) in repeat (each us, each urs, each vs) { | ||
let k = (a, t, y, u, ur, v) | ||
// RUN: %sourcekitd-test -req=cursor -pos=%(line-1):17 %s -- %s | %FileCheck %s --check-prefix=TUPLE1 | ||
// TUPLE1: s:4main3baz2ts2us3urs2vsyxxQp_q_q_Qp1RQy_q_Qpq0_q_QptRvzRv_Rv0_AA1PR_q0_Rh_r1_lF7localFnL_yyRvzRv_Rv0_AaIR_q0_Rh_r1_lF012genericLocalH0L_yyqd__RvzRv_Rv0_AaIR_q0_Rh_r1__lF1kL_qd___qd0__qd1__qd2__AgaIPQyd2__qd2_0_tvp | ||
// -> (A1, A2, A3, A4, A4.main.P.R, B4) | ||
|
||
_ = { | ||
let k = (a, t, y, u, ur, v) | ||
// RUN: %sourcekitd-test -req=cursor -pos=%(line-1):19 %s -- %s | %FileCheck %s --check-prefix=TUPLE2 | ||
// TUPLE2: s:4main3baz2ts2us3urs2vsyxxQp_q_q_Qp1RQy_q_Qpq0_q_QptRvzRv_Rv0_AA1PR_q0_Rh_r1_lF7localFnL_yyRvzRv_Rv0_AaIR_q0_Rh_r1_lF012genericLocalH0L_yyqd__RvzRv_Rv0_AaIR_q0_Rh_r1__lFyycfU_1kL_qd___qd0__qd1__qd2__AgaIPQyd2__qd2_0_tvp | ||
// -> (A1, A2, A3, A4, A4.main.P.R, B4) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In principle I think we could purely rely on gathering them from the type, but I don't think there's any harm in doing this and it's more consistent with the closure logic. I don't feel strongly about it though.