Files
swift-mirror/validation-test/compiler_crashers_2_fixed/0150-rdar39055736.swift
Nathan Hawes 0145439a2b [CSGen] Mark visitDynamicMemberRefExpr as unreachable to match ExprRewriter and update SanitizeExpr to handle them
We were hitting an unreachable in visitDynamicMemberExpr in ExprRewriter when
re-typechecking during a salvage. Check for these earlier (in CSGen) and update
SanitizeExpr to handle them.

Resolves rdar://problem/39055736
2018-03-30 17:17:21 -07:00

18 lines
447 B
Swift

// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck %s -verify
// REQUIRES: objc_interop
import Foundation
@objc class Foo: NSObject {
let x: Int = 0
}
@objc protocol Bar {
@objc optional var foo: Foo {get}
}
func baz(bar: Bar) {
max(bar, bar.foo?.x ?? 0)
// expected-error@-1 {{cannot invoke 'max' with an argument list of type '(Bar, Int)'}}
// expected-note@-2 {{expected an argument list of type '(T, T)'}}
}