@@ -287,11 +287,11 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
287287 * - `T3` is mentioned at `T2.T1` for immediate base type mention `Base<C<T3>>`
288288 * of `Mid`,
289289 * - ``C`1`` is mentioned at `T3` for immediate base type mention `Mid<C<T4>>`
290- * of `Sub`, and
290+ * of `Sub`,
291291 * - `T4` is mentioned at `T3.T1` for immediate base type mention `Mid<C<T4>>`
292- * of `Sub`, and
292+ * of `Sub`,
293293 * - ``C`1`` is mentioned at `T2` and implicitly at `T2.T1` for transitive base type
294- * mention `Base<C<T3>>` of `Sub`.
294+ * mention `Base<C<T3>>` of `Sub`, and
295295 * - `T4` is mentioned implicitly at `T2.T1.T1` for transitive base type mention
296296 * `Base<C<T3>>` of `Sub`.
297297 */
@@ -307,8 +307,7 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
307307 or
308308 // transitive base class
309309 exists ( Type immediateBase | immediateBase = resolveTypeMentionRoot ( immediateBaseMention ) |
310- not t = immediateBase .getATypeParameter ( ) and
311- baseTypeMentionHasTypeAt ( immediateBase , baseMention , path , t )
310+ baseTypeMentionHasNonTypeParameterAt ( immediateBase , baseMention , path , t )
312311 or
313312 exists ( TypePath path0 , TypePath prefix , TypePath suffix , TypeParameter tp |
314313 /*
@@ -336,15 +335,29 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
336335 * ```
337336 */
338337
339- baseTypeMentionHasTypeAt ( immediateBase , baseMention , prefix , tp ) and
340- tp = immediateBase .getATypeParameter ( ) and
338+ baseTypeMentionHasTypeParameterAt ( immediateBase , baseMention , prefix , tp ) and
341339 t = immediateBaseMention .resolveTypeAt ( path0 ) and
342340 path0 .isCons ( tp , suffix ) and
343341 path = prefix .append ( suffix )
344342 )
345343 )
346344 )
347345 }
346+
347+ /** Similar to `baseTypeMentionHasTypeAt` but FIXME: */
348+ pragma [ inline]
349+ predicate baseTypeMentionHasNonTypeParameterAt (
350+ Type sub , TypeMention baseMention , TypePath path , Type t
351+ ) {
352+ not t = sub .getATypeParameter ( ) and baseTypeMentionHasTypeAt ( sub , baseMention , path , t )
353+ }
354+
355+ pragma [ inline]
356+ predicate baseTypeMentionHasTypeParameterAt (
357+ Type sub , TypeMention baseMention , TypePath path , TypeParameter tp
358+ ) {
359+ tp = sub .getATypeParameter ( ) and baseTypeMentionHasTypeAt ( sub , baseMention , path , tp )
360+ }
348361 }
349362
350363 private import BaseTypes
@@ -514,7 +527,7 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
514527 private module AccessBaseType {
515528 /**
516529 * Holds if inferring types at `a` might depend on the type at `path` of
517- * `apos` having `baseMention ` as a transitive base type mention.
530+ * `apos` having `base ` as a transitive base type mention.
518531 */
519532 private predicate relevantAccess ( Access a , AccessPosition apos , TypePath path , Type base ) {
520533 exists ( Declaration target , DeclarationPosition dpos |
@@ -557,8 +570,9 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
557570 * // ^^^^^^^^^^^^^^^^^^^^^^^^^ `a`
558571 * ```
559572 *
560- * where the method call is an access and `new Sub<int>()` is at an
561- * access position, which is the receiver of a method call, we have:
573+ * where the method call is an access, `new Sub<int>()` is at the access
574+ * position which is the receiver of a method call, and `pathToSub` is
575+ * `""` we have:
562576 *
563577 * `baseMention` | `path` | `t`
564578 * ------------- | ------------ | ---
@@ -575,12 +589,10 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
575589 ) {
576590 relevantAccess ( a , apos , pathToSub , resolveTypeMentionRoot ( baseMention ) ) and
577591 exists ( Type sub | sub = a .getInferredType ( apos , pathToSub ) |
578- not t = sub .getATypeParameter ( ) and
579- baseTypeMentionHasTypeAt ( sub , baseMention , path , t )
592+ baseTypeMentionHasNonTypeParameterAt ( sub , baseMention , path , t )
580593 or
581594 exists ( TypePath prefix , TypePath suffix , TypeParameter tp |
582- tp = sub .getATypeParameter ( ) and
583- baseTypeMentionHasTypeAt ( sub , baseMention , prefix , tp ) and
595+ baseTypeMentionHasTypeParameterAt ( sub , baseMention , prefix , tp ) and
584596 t = inferTypeAt ( a , apos , pathToSub , tp , suffix ) and
585597 path = prefix .append ( suffix )
586598 )
@@ -681,15 +693,15 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
681693 * For this example
682694 * ```csharp
683695 * interface IFoo<A> { }
684- * void M<T1, T2>(T2 item) where T2 : IFoo<T1> { }
696+ * T1 M<T1, T2>(T2 item) where T2 : IFoo<T1> { }
685697 * ```
686698 * with the method declaration being the target and the for the first
687699 * parameter position, we have the following
688700 * - `path1 = ""`,
689701 * - `tp1 = T2`,
690702 * - `constraint = IFoo`,
691- * - `path2 = "A"`,
692- * - `tp2 = T1`
703+ * - `path2 = "A"`, and
704+ * - `tp2 = T1`.
693705 */
694706 pragma [ nomagic]
695707 private predicate typeParameterConstraintHasTypeParameter (
0 commit comments