Files
swift-mirror/validation-test/compiler_crashers_2_fixed/0102-sr4575.swift
Slava Pestov fc21ecce68 AST: Don't return hasTypeParameter() for DependentMemberTypes with an ErrorType base
Instead, introduce a new hasDependentMember() recursive property.

The only place that cares about this is associated type inference,
where I changed all existing hasTypeParameter() checks to instead
check (hasTypeParameter() || hasDependentMember()). We could
probably refine this over time and remove some of the
hasTypeParameter() checks, but I'm being conservative for now.

Fixes <https://bugs.swift.org/browse/SR-4575> and
<rdar://problem/31603113>.
2017-05-26 18:10:13 -07:00

14 lines
326 B
Swift

// RUN: not %target-swift-frontend %s -typecheck
struct V<T> : BidirectionalCollection {}
struct S {
func bar<T>(_ to: T.Type) -> V<T> {
return V<T>()
}
}
extension S {
func foo<R>(_ body: (UnsafeBufferPointer<UTF16.CodeUnit>) -> R) -> R {
return Array(self.bar(UTF16.self)).withUnsafeBufferPointer(body)
}
}