Avatar
Avatar
omochimetaru
@swift-main @dynamicMemberLookup public struct OptionalJoin<each V: Codable> { public init(_ v: repeat (each V)?) { self.v = (repeat each v) } public var v: (repeat (each V)?) public subscript<T>(dynamicMember keyPath: KeyPath<(repeat (each V)?), T>) -> T { v[keyPath: keyPath] } } func direct(x: OptionalJoin<Int, String>) -> String? { return x.v.1 } func useDML(x: OptionalJoin<Int, String>) -> String? { // error: Type of expression is ambiguous without a type annotation return x.1 }
swiftNightly BOT 6/23/2025 3:11 AM
exit status 1 with stderr:<stdin>:20:14: error: type of expression is ambiguous without a type annotation 18 | func useDML(x: OptionalJoin<Int, String>) -> String? { 19 | // error: Type of expression is ambiguous without a type annotation 20 | return x.1 | `- error: type of expression is ambiguous without a type annotation 21 | } 22 |