@@ -307,24 +307,22 @@ private module Identity {
307307 private predicate convIdentityStrictConstructedType (
308308 IdentityConvertibleConstructedType fromType , IdentityConvertibleConstructedType toType
309309 ) {
310- /*
311- * Semantically equivalent with
312- * ```
313- * ugt = fromType.getUnboundGeneric()
314- * and
315- * forex(int i |
316- * i in [0 .. ugt.getNumberOfTypeParameters() - 1] |
317- * exists(Type t1, Type t2 |
318- * t1 = getTypeArgument(ugt, fromType, i, _) and
319- * t2 = getTypeArgument(ugt, toType, i, _) |
320- * convIdentity(t1, t2)
321- * )
322- * )
323- * ```
324- * but performance is improved by explicitly evaluating the `i`th argument
325- * only when all preceding arguments are convertible.
326- */
327-
310+ // Semantically equivalent with
311+ // ```
312+ // ugt = fromType.getUnboundGeneric()
313+ // and
314+ // forex(int i |
315+ // i in [0 .. ugt.getNumberOfTypeParameters() - 1] |
316+ // exists(Type t1, Type t2 |
317+ // t1 = getTypeArgument(ugt, fromType, i, _) and
318+ // t2 = getTypeArgument(ugt, toType, i, _) |
319+ // convIdentity(t1, t2)
320+ // )
321+ // )
322+ // ```
323+ // but performance is improved by explicitly evaluating the `i`th argument
324+ // only when all preceding arguments are convertible.
325+ //
328326 fromType != toType and
329327 (
330328 convIdentitySingle ( _, fromType , toType )
@@ -462,11 +460,8 @@ predicate convNullableType(ValueOrRefType fromType, NullableType toType) {
462460 )
463461}
464462
465- /*
466- * This is a deliberate, small Cartesian product, so we have manually lifted it to force the
467- * evaluator to evaluate it in its entirety, rather than trying to optimize it in context.
468- */
469-
463+ // This is a deliberate, small Cartesian product, so we have manually lifted it to force the
464+ // evaluator to evaluate it in its entirety, rather than trying to optimize it in context.
470465pragma [ noinline]
471466private predicate defaultNullConversion ( Type fromType , Type toType ) {
472467 fromType instanceof NullType and convNullType ( toType )
@@ -491,21 +486,15 @@ private predicate convRefTypeNonNull(Type fromType, Type toType) {
491486 convRefTypeParameter ( fromType , toType )
492487}
493488
494- /*
495- * This is a deliberate, small cartesian product, so we have manually lifted it to force the
496- * evaluator to evaluate it in its entirety, rather than trying to optimize it in context.
497- */
498-
489+ // This is a deliberate, small cartesian product, so we have manually lifted it to force the
490+ // evaluator to evaluate it in its entirety, rather than trying to optimize it in context.
499491pragma [ noinline]
500492private predicate defaultDynamicConversion ( Type fromType , Type toType ) {
501493 fromType instanceof RefType and toType instanceof DynamicType
502494}
503495
504- /*
505- * This is a deliberate, small cartesian product, so we have manually lifted it to force the
506- * evaluator to evaluate it in its entirety, rather than trying to optimize it in context.
507- */
508-
496+ // This is a deliberate, small cartesian product, so we have manually lifted it to force the
497+ // evaluator to evaluate it in its entirety, rather than trying to optimize it in context.
509498pragma [ noinline]
510499private predicate defaultDelegateConversion ( RefType fromType , RefType toType ) {
511500 fromType instanceof DelegateType and toType = any ( SystemDelegateClass c ) .getABaseType * ( )
@@ -525,11 +514,8 @@ private predicate convRefTypeRefType(RefType fromType, RefType toType) {
525514 )
526515}
527516
528- /*
529- * This is a deliberate, small cartesian product, so we have manually lifted it to force the
530- * evaluator to evaluate it in its entirety, rather than trying to optimize it in context.
531- */
532-
517+ // This is a deliberate, small cartesian product, so we have manually lifted it to force the
518+ // evaluator to evaluate it in its entirety, rather than trying to optimize it in context.
533519pragma [ noinline]
534520private predicate defaultArrayConversion ( Type fromType , RefType toType ) {
535521 fromType instanceof ArrayType and toType = any ( SystemArrayClass c ) .getABaseType * ( )
@@ -745,28 +731,25 @@ predicate convConversionOperator(Type fromType, Type toType) {
745731
746732/** 13.1.3.2: Variance conversion. */
747733private predicate convVariance ( ConstructedType fromType , ConstructedType toType ) {
748- /*
749- * Semantically equivalent with
750- * ```
751- * ugt = fromType.getUnboundGeneric()
752- * and
753- * forex(int i |
754- * i in [0 .. ugt.getNumberOfTypeParameters() - 1] |
755- * exists(Type t1, Type t2, TypeParameter tp |
756- * t1 = getTypeArgument(ugt, fromType, i, tp) and
757- * t2 = getTypeArgument(ugt, toType, i, tp) |
758- * convIdentity(t1, t2)
759- * or
760- * convRefTypeNonNull(t1, t2) and tp.isOut()
761- * or
762- * convRefTypeNonNull(t2, t1) and tp.isIn()
763- * )
764- * )
765- * ```
766- * but performance is improved by explicitly evaluating the `i`th argument
767- * only when all preceding arguments are convertible.
768- */
769-
734+ // Semantically equivalent with
735+ // ```
736+ // ugt = fromType.getUnboundGeneric()
737+ // and
738+ // forex(int i |
739+ // i in [0 .. ugt.getNumberOfTypeParameters() - 1] |
740+ // exists(Type t1, Type t2, TypeParameter tp |
741+ // t1 = getTypeArgument(ugt, fromType, i, tp) and
742+ // t2 = getTypeArgument(ugt, toType, i, tp) |
743+ // convIdentity(t1, t2)
744+ // or
745+ // convRefTypeNonNull(t1, t2) and tp.isOut()
746+ // or
747+ // convRefTypeNonNull(t2, t1) and tp.isIn()
748+ // )
749+ // )
750+ // ```
751+ // but performance is improved by explicitly evaluating the `i`th argument
752+ // only when all preceding arguments are convertible.
770753 Variance:: convVarianceSingle ( _, fromType , toType )
771754 or
772755 exists ( UnboundGenericType ugt |
0 commit comments