@@ -165,13 +165,10 @@ private void BuildInterfaceIndexes()
165165 var filterIndex = BuildFilterIndex ( implementor ,
166166 typedIndex ?? typeIndexes . Dequeue ( ) ,
167167 NonAbstractTypeWithDescendants ( implementor , hierarchyImplementors ) ) ;
168- var indexesToJoin = new List < IndexInfo > ( 1 + typeIndexes . Count ) ;
169- indexesToJoin . Add ( filterIndex ) ;
170- indexesToJoin . AddRange ( typeIndexes ) ;
171168
172- var indexToApplyView = indexesToJoin . Count > 1
173- ? BuildJoinIndex ( implementor , indexesToJoin )
174- : indexesToJoin [ 0 ] ;
169+ var indexToApplyView = typeIndexes . Count > 0
170+ ? BuildJoinIndex ( implementor , typeIndexes . Prepend ( filterIndex ) )
171+ : filterIndex ;
175172 var indexView = BuildViewIndex ( @interface , indexToApplyView ) ;
176173 underlyingIndex . UnderlyingIndexes . Add ( indexView ) ;
177174 }
@@ -496,7 +493,7 @@ private IndexInfo BuildTypedIndex(TypeInfo reflectedType, IndexInfo realIndex)
496493 var attributes = realIndex . Attributes
497494 & ( IndexAttributes . Primary | IndexAttributes . Secondary | IndexAttributes . Unique | IndexAttributes . Abstract )
498495 | IndexAttributes . Typed | IndexAttributes . Virtual ;
499- var result = new IndexInfo ( reflectedType , attributes , realIndex , Array . Empty < IndexInfo > ( ) ) ;
496+ var result = new IndexInfo ( reflectedType , attributes , realIndex , addAncestorToUnderlyings : true ) ;
500497
501498 // Adding key columns
502499 foreach ( KeyValuePair < ColumnInfo , Direction > pair in realIndex . KeyColumns ) {
@@ -531,7 +528,7 @@ private IndexInfo BuildFilterIndex(TypeInfo reflectedType, IndexInfo indexToFilt
531528 var attributes = indexToFilter . Attributes
532529 & ( IndexAttributes . Primary | IndexAttributes . Secondary | IndexAttributes . Unique | IndexAttributes . Abstract )
533530 | IndexAttributes . Filtered | IndexAttributes . Virtual ;
534- var result = new IndexInfo ( reflectedType , attributes , indexToFilter , Array . Empty < IndexInfo > ( ) ) {
531+ var result = new IndexInfo ( reflectedType , attributes , indexToFilter , addAncestorToUnderlyings : true ) {
535532 FilterByTypes = filterByTypes
536533 } ;
537534
@@ -560,11 +557,10 @@ private IndexInfo BuildJoinIndex(TypeInfo reflectedType, IEnumerable<IndexInfo>
560557 {
561558 var nameBuilder = context . NameBuilder ;
562559 var firstIndex = indexesToJoin . First ( ) ;
563- var otherIndexes = indexesToJoin . Skip ( 1 ) . ToArray ( ) ;
564560 var attributes = firstIndex . Attributes
565561 & ( IndexAttributes . Primary | IndexAttributes . Secondary | IndexAttributes . Unique )
566562 | IndexAttributes . Join | IndexAttributes . Virtual ;
567- var result = new IndexInfo ( reflectedType , attributes , firstIndex , otherIndexes ) ;
563+ var result = new IndexInfo ( reflectedType , attributes , indexesToJoin ) ;
568564
569565 // Adding key columns
570566 foreach ( KeyValuePair < ColumnInfo , Direction > pair in firstIndex . KeyColumns ) {
@@ -645,11 +641,10 @@ private IndexInfo BuildUnionIndex(TypeInfo reflectedType, IEnumerable<IndexInfo>
645641 {
646642 var nameBuilder = context . NameBuilder ;
647643 var firstIndex = indexesToUnion . First ( ) ;
648- var otherIndexes = indexesToUnion . Skip ( 1 ) . ToArray ( ) ;
649644 var attributes = firstIndex . Attributes
650645 & ( IndexAttributes . Primary | IndexAttributes . Secondary | IndexAttributes . Unique )
651646 | IndexAttributes . Union | IndexAttributes . Virtual ;
652- var result = new IndexInfo ( reflectedType , attributes , firstIndex , otherIndexes ) ;
647+ var result = new IndexInfo ( reflectedType , attributes , indexesToUnion ) ;
653648
654649 // Adding key columns
655650 foreach ( KeyValuePair < ColumnInfo , Direction > pair in firstIndex . KeyColumns ) {
@@ -682,7 +677,7 @@ private IndexInfo BuildViewIndex(TypeInfo reflectedType, IndexInfo indexToApplyV
682677 var attributes = indexToApplyView . Attributes
683678 & ( IndexAttributes . Primary | IndexAttributes . Secondary | IndexAttributes . Unique | IndexAttributes . Abstract )
684679 | IndexAttributes . View | IndexAttributes . Virtual ;
685- var result = new IndexInfo ( reflectedType , attributes , indexToApplyView , Array . Empty < IndexInfo > ( ) ) ;
680+ var result = new IndexInfo ( reflectedType , attributes , indexToApplyView , addAncestorToUnderlyings : true ) ;
686681
687682 // Adding key columns
688683 foreach ( KeyValuePair < ColumnInfo , Direction > pair in indexToApplyView . KeyColumns ) {
0 commit comments