ArchetypeBuilder: use enumerateRequirements() in getGenericSignature()

Instead of walking over PotentialArchetypes representatives directly
and using a separate list to record same-type constraints, just use
enumerateRequirements() and check the RequirementSource to drop
redundant requirements.

This means getGenericSignature() and getCanonicalManglingSignature()
can share the same logic for collecting requirements; the only
differences are the following:

- both drop requirements from Redundant sources, but mangling
  signatures also drop requirements from Protocol sources

- mangling signatures also canonicalize the types appearing in the
  final requirement
This commit is contained in:
Slava Pestov
2016-08-30 18:07:16 -07:00
parent f19192d498
commit 7a7af62012
11 changed files with 96 additions and 285 deletions

View File

@@ -19,11 +19,11 @@ func bar() {
// CHECK: apply [[ZIM_DFLT]]<Int, Int>
Zim.zim()
// CHECK: [[ZANG_DFLT_0:%.*]] = function_ref @_TIZFV25default_arguments_generic3Zim4zang
// CHECK: apply [[ZANG_DFLT_0]]<Int, Int, Double, Double>
// CHECK: apply [[ZANG_DFLT_0]]<Int, Double, Int, Double>
// CHECK: [[ZANG_DFLT_1:%.*]] = function_ref @_TIZFV25default_arguments_generic3Zim4zang
// CHECK: apply [[ZANG_DFLT_1]]<Int, Int, Double, Double>
// CHECK: apply [[ZANG_DFLT_1]]<Int, Double, Int, Double>
Zim.zang()
// CHECK: [[ZANG_DFLT_1:%.*]] = function_ref @_TIZFV25default_arguments_generic3Zim4zang
// CHECK: apply [[ZANG_DFLT_1]]<Int, Int, Double, Double>
// CHECK: apply [[ZANG_DFLT_1]]<Int, Double, Int, Double>
Zim.zang(22)
}