@@ -36,8 +36,13 @@ newtype TType =
3636 TTrait ( Trait t ) or
3737 TImplTraitType ( ImplTraitTypeRepr impl ) or
3838 TDynTraitType ( Trait t ) { t = any ( DynTraitTypeRepr dt ) .getTrait ( ) } or
39- TNeverType ( ) or
4039 TUnknownType ( ) or
40+ TClosureParameterPseudoType ( Param p ) {
41+ exists ( ClosureExpr ce |
42+ p = ce .getParam ( _) and
43+ not p .hasTypeRepr ( )
44+ )
45+ } or
4146 TTypeParamTypeParameter ( TypeParam t ) or
4247 TAssociatedTypeTypeParameter ( Trait trait , AssocType typeAlias ) {
4348 getTraitAssocType ( trait ) = typeAlias
@@ -326,14 +331,6 @@ TypeParamTypeParameter getSliceTypeParameter() {
326331 result = any ( SliceType t ) .getPositionalTypeParameter ( 0 )
327332}
328333
329- class NeverType extends Type , TNeverType {
330- override TypeParameter getPositionalTypeParameter ( int i ) { none ( ) }
331-
332- override string toString ( ) { result = "!" }
333-
334- override Location getLocation ( ) { result instanceof EmptyLocation }
335- }
336-
337334abstract class PtrType extends StructType { }
338335
339336pragma [ nomagic]
@@ -355,6 +352,10 @@ class PtrConstType extends PtrType {
355352 override string toString ( ) { result = "*const" }
356353}
357354
355+ abstract class PseudoType extends Type {
356+ override TypeParameter getPositionalTypeParameter ( int i ) { none ( ) }
357+ }
358+
358359/**
359360 * A special pseudo type used to indicate that the actual type may have to be
360361 * inferred by propagating type information back into call arguments.
@@ -377,14 +378,24 @@ class PtrConstType extends PtrType {
377378 * into call arguments (including method call receivers), in order to avoid
378379 * combinatorial explosions.
379380 */
380- class UnknownType extends Type , TUnknownType {
381- override TypeParameter getPositionalTypeParameter ( int i ) { none ( ) }
382-
383- override string toString ( ) { result = "(context typed)" }
381+ class UnknownType extends PseudoType , TUnknownType {
382+ override string toString ( ) { result = "(unknown type)" }
384383
385384 override Location getLocation ( ) { result instanceof EmptyLocation }
386385}
387386
387+ class ClosureParameterPseudoType extends PseudoType , TClosureParameterPseudoType {
388+ private Param param ;
389+
390+ ClosureParameterPseudoType ( ) { this = TClosureParameterPseudoType ( param ) }
391+
392+ Param getParam ( ) { result = param }
393+
394+ override string toString ( ) { result = "(closure parameter " + param + ")" }
395+
396+ override Location getLocation ( ) { result = param .getLocation ( ) }
397+ }
398+
388399/** A type parameter. */
389400abstract class TypeParameter extends Type {
390401 override TypeParameter getPositionalTypeParameter ( int i ) { none ( ) }
0 commit comments