@@ -38,14 +38,12 @@ public override void Populate()
3838 Context . Compilation . GetTypeByMetadataName ( valueTypeName ) :
3939 Context . Compilation . ObjectType ;
4040
41- var constraintTypes = new List < Type > ( ) ;
4241 foreach ( var abase in symbol . ConstraintTypes )
4342 {
4443 if ( abase . TypeKind != TypeKind . Interface )
4544 baseType = abase ;
4645 var t = Create ( Context , abase ) ;
4746 Context . Emit ( Tuples . specific_type_parameter_constraints ( constraints , t . TypeRef ) ) ;
48- constraintTypes . Add ( t ) ;
4947 }
5048
5149 Context . Emit ( Tuples . types ( this , Semmle . Extraction . Kinds . TypeKind . TYPE_PARAMETER , symbol . Name ) ) ;
@@ -67,12 +65,15 @@ public override void Populate()
6765 clauses = clauses . Concat ( declSyntaxReferences . OfType < ClassDeclarationSyntax > ( ) . SelectMany ( c => c . ConstraintClauses ) ) ;
6866 clauses = clauses . Concat ( declSyntaxReferences . OfType < InterfaceDeclarationSyntax > ( ) . SelectMany ( c => c . ConstraintClauses ) ) ;
6967 clauses = clauses . Concat ( declSyntaxReferences . OfType < StructDeclarationSyntax > ( ) . SelectMany ( c => c . ConstraintClauses ) ) ;
70- int i = 0 ;
71- foreach ( var clause in clauses . Where ( c => c . Name . ToString ( ) == symbol . Name ) )
68+ foreach ( var clause in clauses . Where ( c => c . Name . Identifier . Text == symbol . Name ) )
7269 {
7370 TypeMention . Create ( Context , clause . Name , this , this ) ;
7471 foreach ( var constraint in clause . Constraints . OfType < TypeConstraintSyntax > ( ) )
75- TypeMention . Create ( Context , constraint . Type , this , constraintTypes [ i ++ ] ) ;
72+ {
73+ var ti = Context . Model ( constraint ) . GetTypeInfo ( constraint . Type ) ;
74+ var target = Type . Create ( Context , ti . Type ) ;
75+ TypeMention . Create ( Context , constraint . Type , this , target ) ;
76+ }
7677 }
7778 }
7879 }
0 commit comments