@@ -206,6 +206,7 @@ private module MkTypeMention<getAdditionalPathTypeAtSig/2 getAdditionalPathTypeA
206206 exists ( TypeParamItemNode tp | this = tp .getABoundPath ( ) and result = tp )
207207 }
208208
209+ pragma [ nomagic]
209210 private Type getDefaultPositionalTypeArgument ( int i , TypePath path ) {
210211 // If a type argument is not given in the path, then we use the default for
211212 // the type parameter if one exists for the type.
@@ -228,6 +229,11 @@ private module MkTypeMention<getAdditionalPathTypeAtSig/2 getAdditionalPathTypeA
228229 this = any ( PathTypeRepr ptp ) .getPath ( ) .getQualifier * ( )
229230 }
230231
232+ pragma [ nomagic]
233+ private TypeParameter getPositionalTypeParameter ( int i ) {
234+ result = this .resolveRootType ( ) .getPositionalTypeParameter ( i )
235+ }
236+
231237 /**
232238 * Gets the default type for the type parameter `tp` at `path`, if any.
233239 *
@@ -242,27 +248,27 @@ private module MkTypeMention<getAdditionalPathTypeAtSig/2 getAdditionalPathTypeA
242248 Type getDefaultTypeForTypeParameterInNonAnnotationAt ( TypeParameter tp , TypePath path ) {
243249 not this .isInTypeAnnotation ( ) and
244250 exists ( int i |
245- result = this .getDefaultPositionalTypeArgument ( pragma [ only_bind_into ] ( i ) , path ) and
246- tp = this .resolveRootType ( ) . getPositionalTypeParameter ( pragma [ only_bind_into ] ( i ) )
251+ result = this .getDefaultPositionalTypeArgument ( i , path ) and
252+ tp = this .getPositionalTypeParameter ( i )
247253 )
248254 }
249255
256+ pragma [ nomagic]
250257 private Type getPositionalTypeArgument ( int i , TypePath path ) {
251258 result = getPathTypeArgument ( this , i ) .getTypeAt ( path )
252- or
253- // Defaults only apply to type mentions in type annotations
254- this .isInTypeAnnotation ( ) and
255- result = this .getDefaultPositionalTypeArgument ( i , path )
256259 }
257260
258261 /**
259262 * Gets the type for this path for the type parameter `tp` at `path`, when the
260263 * type parameter does not correspond directly to a type mention.
261264 */
262265 private Type getTypeForTypeParameterAt ( TypeParameter tp , TypePath path ) {
263- exists ( int i |
264- result = this .getPositionalTypeArgument ( pragma [ only_bind_into ] ( i ) , path ) and
265- tp = this .resolveRootType ( ) .getPositionalTypeParameter ( pragma [ only_bind_into ] ( i ) )
266+ exists ( int i | tp = this .getPositionalTypeParameter ( i ) |
267+ result = this .getPositionalTypeArgument ( i , path )
268+ or
269+ // Defaults only apply to type mentions in type annotations
270+ this .isInTypeAnnotation ( ) and
271+ result = this .getDefaultPositionalTypeArgument ( i , path )
266272 )
267273 or
268274 // Handle the special syntactic sugar for function traits. The syntactic
0 commit comments