mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Add a test to validate that we infer the right level of optionality for weak vars.
This commit is contained in:
10
test/Constraints/weak.swift
Normal file
10
test/Constraints/weak.swift
Normal 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)
|
||||
Reference in New Issue
Block a user