@@ -327,20 +327,25 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
327
327
* // ^^^^^^^^^^^^^ `constraint`
328
328
* ```
329
329
*
330
- * Note that the type parameters in `abs` significantly change the meaning
331
- * of type parameters that occur in `condition`. For instance, in the Rust
332
- * example
330
+ * To see how `abs` change the meaning of the type parameters that occur in
331
+ * `condition`, consider the following examples in Rust:
333
332
* ```rust
334
- * fn foo<T: Trait>() { }
333
+ * impl<T> Trait for T { }
334
+ * // ^^^ `abs` ^ `condition`
335
+ * // ^^^^^ `constraint`
335
336
* ```
336
- * we have that the type parameter `T` satisfies the constraint `Trait`. But,
337
- * only that specific `T` satisfy the constraint. Hence we would not have
338
- * `T` in `abs`. On the other hand, in the Rust example
337
+ * Here the meaning is "for all type parameters `T` it is the case that `T`
338
+ * implements `Trait`". On the other hand, in
339
339
* ```rust
340
- * impl<T> Trait for T { }
340
+ * fn foo<T: Trait>() { }
341
+ * // ^ `condition`
342
+ * // ^^^^^ `constraint`
341
343
* ```
342
- * the constraint `Trait` is in fact satisfied for all types, and we would
343
- * have `T` in `abs` to make it free in the condition.
344
+ * the meaning is "`T` implements `Trait`" where the constraint is only
345
+ * valid for the specific `T`. Note that `condition` and `condition` are
346
+ * identical in the two examples. To encode the difference, `abs` in the
347
+ * first example should contain `T` whereas in the seconds example `abs`
348
+ * should be empty.
344
349
*/
345
350
predicate conditionSatisfiesConstraint (
346
351
TypeAbstraction abs , TypeMention condition , TypeMention constraint
@@ -359,9 +364,24 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
359
364
360
365
signature module IsInstantiationOfInputSig< TypeTreeSig App> {
361
366
/**
362
- * Holds if `abs` is a type abstraction under which `tm` occurs and if
363
- * `app` is potentially the result of applying the abstraction to type
364
- * some type argument.
367
+ * Holds if `abs` is a type abstraction, `tm` occurs under `abs`, and
368
+ * `app` is potentially an application/instantiation of `abs`.
369
+ *
370
+ * For example:
371
+ * ```rust
372
+ * impl<A> Foo<A, A> {
373
+ * // ^^^ `abs`
374
+ * // ^^^^^^^^^ `tm`
375
+ * fn bar(self) { ... }
376
+ * }
377
+ * // ...
378
+ * foo.bar();
379
+ * // ^^^ `app`
380
+ * ```
381
+ * Here `abs` introduces the type parameter `A` and `tm` occurs under
382
+ * `abs` (i.e., `A` is bound in `tm` by `abs`). On the last line,
383
+ * accessing the `bar` method of `foo` potentially instantiates the `impl`
384
+ * block with a type argument for `A`.
365
385
*/
366
386
predicate potentialInstantiationOf ( App app , TypeAbstraction abs , TypeMention tm ) ;
367
387
0 commit comments