Commit Graph

2 Commits

Author SHA1 Message Date
practicalswift
4ad5ed4ada [crashers] License: Apache License v2.0 with Runtime Library Exception 2016-03-11 22:35:33 +01:00
Jacob Bandes-Storch
b97cb48c2b [AST] Fix inconsistent handling of generic args & params during BoundGenericType::getSubstitutions
A decl’s full GenericSignature is set during validateGenericTypeSignature().

Then during ConstraintSystem::openTypes(), in ReplaceDependentTypes, the GenericArgs list is built from the generic signature (via getGenericParamTypes()) and passed into a new BoundGenericType.

In BoundGenericType::getSubstitutions(), the GenericArgs are assumed to match getGenericParamsOfContext()->getParams().

However, in reality, the GenericArgs include all levels of generic args, whereas getGenericParamsOfContext() are the params of the innermost context only, so the params array is accessed past its end.

This commit changes NominalTypeDecl::getGenericParamTypes() to return the innermost params, in order to match the output of BoundGenericType::getGenericArgs(). For clarity and to hopefully prevent future confusion, we also rename getGenericParamTypes() to getInnermostGenericParamTypes().
2016-01-09 02:19:28 -08:00