Commit Graph

54 Commits

Author SHA1 Message Date
Doug Gregor
fbbfe266f9 Check presence/absence/arity of generic parameters during extension binding.
Extension binding decides which nominal type declaration is extended
by a given extension, so perform basic validation to ensure that the
generic parameter lists provided in the extension make sense. Note
that we're not checking the actual generic parameters properly in
the nested case, so none of this actually works at all. That will come
next, over in extension validation.

Swift SVN r20724
2014-07-29 23:53:45 +00:00
Doug Gregor
657c53fb18 Small test of name lookup behavior for extensions with generic parameters.
Swift SVN r20707
2014-07-29 22:43:19 +00:00
Doug Gregor
2162893fbe Start validating the generic parameters on extensions.
Extensions must have the same number of generic parameters as the
generic type they extend, and cannot add any additional requirements
beyond those on the extended generic type (yet!). We use requirement
inference to allow one to provide fewer requirements on the extension
than exist on the generic type. The expectation here is that one won't
ever repeat the requirements from the generic type.

Swift SVN r20706
2014-07-29 22:43:18 +00:00
Doug Gregor
a0bc9274db Change parsing and representation of extensions to accommodate generic parameters.
The eventual goal for extensions of generic types is to require them
to specify their generic parameters, e.g.,

  extension Array<T> { ... }

rather than today's

  extension Array { ... }

Start parsing (optional) generic parameters here, and update the
representation of ExtensionDecl to accomodate this new grammar
production. Aside from the parser changes, there's no intended
functionality change here.

Swift SVN r20682
2014-07-29 19:17:00 +00:00