Skip to content
This repository has been archived by the owner on Nov 1, 2020. It is now read-only.

Commit

Permalink
Adjust TemplateConstructableTypes to ensure that templates are present
Browse files Browse the repository at this point in the history
- Previous logic worked except for types without methods (interfaces and structures) due to other rules that ensured the presence of a TemplateTypeLayout

Fixes #4860

[tfs-changeset: 1680445]
  • Loading branch information
davidwrighton committed Nov 7, 2017
1 parent 09548ab commit 1dc677b
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,13 @@ public IEnumerable<IDependencyNode> TemplateConstructableTypes(TypeDesc type)
TypeDesc canonicalType = type.ConvertToCanonForm(CanonicalFormKind.Specific);
yield return _factory.MaximallyConstructableType(canonicalType);

// Add a dependency on the template for this type, if the canonical type should be generated into this binary.
if (canonicalType.IsCanonicalSubtype(CanonicalFormKind.Any) && !_factory.NecessaryTypeSymbol(canonicalType).RepresentsIndirectionCell)
{
if (!_factory.TypeSystemContext.IsCanonicalDefinitionType(canonicalType, CanonicalFormKind.Any))
yield return _factory.NativeLayout.TemplateTypeLayout(canonicalType);
}

foreach (TypeDesc instantiationType in type.Instantiation)
{
foreach (var dependency in TemplateConstructableTypes(instantiationType))
Expand Down

0 comments on commit 1dc677b

Please sign in to comment.