Commits

Doug Gregor committed 09e64a02434
Resolve unbound generic type references within their definitions. When the name of a generic type is referenced, without any generic arguments, within the definition of a generic type (or extensions of that generic type), use the generic arguments provided by that context. Thus, within the definition of X<T> below, one can simply use 'X' as a shorthand for 'X<T>': class X<T> { func swap(other : X) { /* ... */ } // same as "func swap(other : X<T>)" } This resolution provides essentially the same behavior as the injected class name does in C++. Note that this rule overrides any inference rules, such that (for example) the following is ill-formed rather than inferring the generic arguments of 'X': class X<T> { func foo() { var xi : X<Int> = X() } } Note that name binding has changed slightly: when unqualified lookup finds a type declaration within a nominal type, it is now treated as a DeclRefExpr (or overloaded variant thereof) rather than as a member access with an implicit 'this'. Fixes <rdar://problem/14078437>. Swift SVN r6049