Add a test to validate that we infer the right level of optionality for weak vars.

This commit is contained in:
Mark Lacey
2018-03-27 16:36:48 -07:00
parent 16b5fe3d8c
commit 256a31aa3a

View File

@@ -0,0 +1,10 @@
// RUN: %target-typecheck-verify-swift
class C {}
func overload(x: Int) -> C {}
func overload(x: Float) -> C? {}
// Ensure that we infer both weak vars as having a single level of
// optionality. We will emit diagnostics if that is not the case.
weak var v = overload(x: 1)
weak var w = overload(x: 1.0)