Skip to content

Commit 4f9f13c

Browse files
committed
---
yaml --- r: 268153 b: refs/heads/marcrasi-const-evaluator-part-2 c: d4fe6e9 h: refs/heads/master i: 268151: 99ba01d
1 parent ec8c3d7 commit 4f9f13c

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1081,7 +1081,7 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-09-28-a: c30bf9b3ca148b1b90ebcd80141d9
10811081
refs/heads/bananaphone: 2af9a1dc7f40dcb4b2949876f7e237763d1a7972
10821082
refs/heads/marcrasi-const-evaluator-part-3: 867d96d6aa4cfb5079b7478be617387a1f621c88
10831083
refs/heads/marcrasi-const-evaluator-part-1: 390daeaeea2181a1fc24910e09b5861053cd3558
1084-
refs/heads/marcrasi-const-evaluator-part-2: cc2ee165a1229243ed03ca64b6e407d0f9f653aa
1084+
refs/heads/marcrasi-const-evaluator-part-2: d4fe6e9ff71b33650956969faca114df0e1148e1
10851085
refs/heads/revert-19689-keep-sourcekitd-response-alive-while-variant-lives: b5b1d9ab2340a64a3c7332529cdca1cb2318d93c
10861086
refs/tags/swift-4.2-DEVELOPMENT-SNAPSHOT-2018-10-01-a: 63059bdab8bbcdd68591738fa28c68c8c19bde75
10871087
refs/tags/swift-4.2-DEVELOPMENT-SNAPSHOT-2018-10-02-a: 12514879eff2c34a64ac6e65b323447f6525cfd0

branches/marcrasi-const-evaluator-part-2/stdlib/public/runtime/MetadataLookup.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,6 +1326,9 @@ buildEnvironmentPath(
13261326
unsigned totalKeyParamCount = 0;
13271327
auto genericParams = environment->getGenericParameters();
13281328
for (unsigned numLocalParams : environment->getGenericParameterCounts()) {
1329+
// Adkjust totalParamCount so we have the # of local parameters.
1330+
numLocalParams -= totalParamCount;
1331+
13291332
// Get the local generic parameters.
13301333
auto localGenericParams = genericParams.slice(0, numLocalParams);
13311334
genericParams = genericParams.slice(numLocalParams);

branches/marcrasi-const-evaluator-part-2/test/stdlib/KeyPath.swift

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -768,6 +768,34 @@ keyPath.test("optional chaining component that needs generic instantiation") {
768768
Value6096<Int>().doSomething()
769769
}
770770

771+
// Nested generics.
772+
protocol HasAssoc {
773+
associatedtype A
774+
}
775+
776+
struct Outer<T, U> {
777+
struct Middle<V, W, X> {
778+
}
779+
}
780+
781+
extension Outer.Middle where V: HasAssoc, U == V.A, W == X {
782+
struct Inner<Y: Hashable> {
783+
func foo() -> AnyKeyPath {
784+
return \[Y?: [U]].values
785+
}
786+
}
787+
}
788+
789+
extension Double: HasAssoc {
790+
typealias A = Float
791+
}
792+
793+
keyPath.test("nested generics") {
794+
let nested = Outer<Int, Float>.Middle<Double, String, String>.Inner<UInt>()
795+
let nestedKeyPath = nested.foo()
796+
typealias DictType = [UInt? : [Float]]
797+
expectTrue(nestedKeyPath is KeyPath<DictType, DictType.Values>)
798+
}
771799

772800
runAllTests()
773801

0 commit comments

Comments
 (0)