Skip to content

Commit 6ca4a3d

Browse files
committed
[Tests] Add a test-case that regresses if generic arguments are attempted sooner
This is related to 22e0f4a. Binding inference doesn't mark type variables that appear in dependent member chains as "adjacent" which means that type variables that represent generic arguments cannot be attempted sooner due to incomplete information provided by the inference. To fix this we'd need to remove `findInferrableTypeVars` and replace its uses with `Type::getTypeVariables(...)`. This is a risky change that would require some evaluation because it could end breaking existing code but it would make sure that for cases like `Row<$T0> conv $T1.ArrayLiteralElement` `$T0` always gets associated with `$T1`.
1 parent 401f3f3 commit 6ca4a3d

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/Constraints/array_literal.swift

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,3 +393,25 @@ struct TestMultipleOverloadedInits {
393393
let _ = [Float(x), Float(x), Float(x), Float(x)]
394394
}
395395
}
396+
397+
do {
398+
struct Section {
399+
var rows: [Row<Any>]?
400+
}
401+
402+
struct Row<T> {
403+
init(value: T?) {}
404+
}
405+
406+
struct Asset {
407+
var orientation: Int32
408+
}
409+
410+
func test(asset: Asset) -> [Section] {
411+
return [
412+
Section(rows: [
413+
Row(value: String(describing: asset.orientation)) // Ok
414+
])
415+
]
416+
}
417+
}

0 commit comments

Comments
 (0)