Files
swift-mirror/test/ModuleInterface/Inputs/ConformancesUser.swift
Jordan Rose eeb8f330f9 [ModuleInterface] Allow conformances to be missing value witnesses (#18932)
It's not clear whether we'll actually need this feature in the long
run, but we certainly need it now because non-@usableFromInline
members can (currently) satisfy public requirements when a
@usableFromInline internal type conforms to a public protocol. In
these cases, we'll treat the witnesses as present but opaque, and
clients will perform dynamic dispatch when using them even when
a generic function gets specialized.

With this, we're able to generate a textual interface for the standard
library, compile it back to a swiftmodule, and use it to build a Hello
World program!
2018-08-23 16:46:06 -07:00

17 lines
301 B
Swift

import Conformances
func testGeneric<T: MyProto>(_: T.Type) -> Int {
var impl = T.init()
impl.method()
impl.prop = 0
return impl[0]
}
public func testFull() -> Int {
return testGeneric(FullStructImpl.self)
}
public func testOpaque() -> Int {
return testGeneric(OpaqueStructImpl.self)
}