Files
swift-mirror/validation-test/compiler_crashers/0323-swift-apply-generic-protocol.swift
David Farler 87c3d7421f Refine static func and var syntax
rdar://problem/17198298

- Allow 'static' in protocol property and func requirements, but not 'class'.
- Allow 'static' methods in classes - they are 'class final'.
- Only allow 'class' methods in classes (or extensions of classes)
- Remove now unneeded diagnostics related to finding 'static' in previously banned places.
- Update relevant diagnostics to make the new rules clear.

Swift SVN r24260
2015-01-08 03:03:29 +00:00

16 lines
423 B
Swift

// RUN: %target-swift-frontend %s -emit-sil -verify
// Distributed under the terms of the MIT license
// Test case submitted to project by http://github.com/valfer (Valerio Ferrucci)
protocol C {
static func c(o: AnyObject) -> Self?
}
func d<A,B>(a : A, f : A -> B) -> B {
} // expected-error {{missing return in a function expected to return 'B'}}
class D<A:C> {
func e(o: AnyObject) {
d(o, A.c)
}
}