Ignored conditional unwrapping in Silver

(ndelic) #1

IDE: Visual Studio 2017/Fire
Version: .2373
Target (If relevant): WPF/Android

This produces NullReferenceException, although it shouldn’t (and doesn’t in XCode). Test project attached.

public class SomeClass {

    private func doSomething() {

        let test = EventTest()
        test.onTest?(test)  //  NullReferenceException

public class EventTest {
    public var onTest: EventTestDelegate?

public typealias EventTestDelegate = (aTest: EventTest) -> ()

TestNullableEvent.zip (306.5 KB)

(ndelic) #2

Interesting, this only happens with delegates i.e. typealias SomeDelegate = (String) -> (), it doesn’t happen with regular variables.

(RemObjects) #3

Thanks, logged as bugs://82143

(RemObjects) #4

bugs://82143 got closed with status fixed.