Skip to content

Commit 256a31a

Browse files
committed
Add a test to validate that we infer the right level of optionality for weak vars.
1 parent 16b5fe3 commit 256a31a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/Constraints/weak.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// RUN: %target-typecheck-verify-swift
2+
3+
class C {}
4+
func overload(x: Int) -> C {}
5+
func overload(x: Float) -> C? {}
6+
7+
// Ensure that we infer both weak vars as having a single level of
8+
// optionality. We will emit diagnostics if that is not the case.
9+
weak var v = overload(x: 1)
10+
weak var w = overload(x: 1.0)

0 commit comments

Comments
 (0)