1// Code generated by simplePredicates_generate.go; DO NOT EDIT 2 3package typep 4 5import ( 6 "go/types" 7) 8 9// Simple 1-to-1 type predicates via type assertion. 10 11// IsBasic reports whether a given type has *types.Basic type. 12func IsBasic(typ types.Type) bool { 13 _, ok := typ.(*types.Basic) 14 return ok 15} 16 17// IsArray reports whether a given type has *types.Array type. 18func IsArray(typ types.Type) bool { 19 _, ok := typ.(*types.Array) 20 return ok 21} 22 23// IsSlice reports whether a given type has *types.Slice type. 24func IsSlice(typ types.Type) bool { 25 _, ok := typ.(*types.Slice) 26 return ok 27} 28 29// IsStruct reports whether a given type has *types.Struct type. 30func IsStruct(typ types.Type) bool { 31 _, ok := typ.(*types.Struct) 32 return ok 33} 34 35// IsPointer reports whether a given type has *types.Pointer type. 36func IsPointer(typ types.Type) bool { 37 _, ok := typ.(*types.Pointer) 38 return ok 39} 40 41// IsTuple reports whether a given type has *types.Tuple type. 42func IsTuple(typ types.Type) bool { 43 _, ok := typ.(*types.Tuple) 44 return ok 45} 46 47// IsSignature reports whether a given type has *types.Signature type. 48func IsSignature(typ types.Type) bool { 49 _, ok := typ.(*types.Signature) 50 return ok 51} 52 53// IsInterface reports whether a given type has *types.Interface type. 54func IsInterface(typ types.Type) bool { 55 _, ok := typ.(*types.Interface) 56 return ok 57} 58 59// IsMap reports whether a given type has *types.Map type. 60func IsMap(typ types.Type) bool { 61 _, ok := typ.(*types.Map) 62 return ok 63} 64 65// IsChan reports whether a given type has *types.Chan type. 66func IsChan(typ types.Type) bool { 67 _, ok := typ.(*types.Chan) 68 return ok 69} 70 71// IsNamed reports whether a given type has *types.Named type. 72func IsNamed(typ types.Type) bool { 73 _, ok := typ.(*types.Named) 74 return ok 75} 76 77// *types.Basic predicates for the info field. 78 79// HasBooleanProp reports whether typ is a *types.Basic has IsBoolean property. 80func HasBooleanProp(typ types.Type) bool { 81 if typ, ok := typ.(*types.Basic); ok { 82 return typ.Info()&types.IsBoolean != 0 83 } 84 return false 85} 86 87// HasIntegerProp reports whether typ is a *types.Basic has IsInteger property. 88func HasIntegerProp(typ types.Type) bool { 89 if typ, ok := typ.(*types.Basic); ok { 90 return typ.Info()&types.IsInteger != 0 91 } 92 return false 93} 94 95// HasUnsignedProp reports whether typ is a *types.Basic has IsUnsigned property. 96func HasUnsignedProp(typ types.Type) bool { 97 if typ, ok := typ.(*types.Basic); ok { 98 return typ.Info()&types.IsUnsigned != 0 99 } 100 return false 101} 102 103// HasFloatProp reports whether typ is a *types.Basic has IsFloat property. 104func HasFloatProp(typ types.Type) bool { 105 if typ, ok := typ.(*types.Basic); ok { 106 return typ.Info()&types.IsFloat != 0 107 } 108 return false 109} 110 111// HasComplexProp reports whether typ is a *types.Basic has IsComplex property. 112func HasComplexProp(typ types.Type) bool { 113 if typ, ok := typ.(*types.Basic); ok { 114 return typ.Info()&types.IsComplex != 0 115 } 116 return false 117} 118 119// HasStringProp reports whether typ is a *types.Basic has IsString property. 120func HasStringProp(typ types.Type) bool { 121 if typ, ok := typ.(*types.Basic); ok { 122 return typ.Info()&types.IsString != 0 123 } 124 return false 125} 126 127// HasUntypedProp reports whether typ is a *types.Basic has IsUntyped property. 128func HasUntypedProp(typ types.Type) bool { 129 if typ, ok := typ.(*types.Basic); ok { 130 return typ.Info()&types.IsUntyped != 0 131 } 132 return false 133} 134 135// HasOrderedProp reports whether typ is a *types.Basic has IsOrdered property. 136func HasOrderedProp(typ types.Type) bool { 137 if typ, ok := typ.(*types.Basic); ok { 138 return typ.Info()&types.IsOrdered != 0 139 } 140 return false 141} 142 143// HasNumericProp reports whether typ is a *types.Basic has IsNumeric property. 144func HasNumericProp(typ types.Type) bool { 145 if typ, ok := typ.(*types.Basic); ok { 146 return typ.Info()&types.IsNumeric != 0 147 } 148 return false 149} 150 151// HasConstTypeProp reports whether typ is a *types.Basic has IsConstType property. 152func HasConstTypeProp(typ types.Type) bool { 153 if typ, ok := typ.(*types.Basic); ok { 154 return typ.Info()&types.IsConstType != 0 155 } 156 return false 157} 158 159// *types.Basic predicates for the kind field. 160 161// HasBoolKind reports whether typ is a *types.Basic with its kind set to types.Bool. 162func HasBoolKind(typ types.Type) bool { 163 if typ, ok := typ.(*types.Basic); ok { 164 return typ.Kind() == types.Bool 165 } 166 return false 167} 168 169// HasIntKind reports whether typ is a *types.Basic with its kind set to types.Int. 170func HasIntKind(typ types.Type) bool { 171 if typ, ok := typ.(*types.Basic); ok { 172 return typ.Kind() == types.Int 173 } 174 return false 175} 176 177// HasInt8Kind reports whether typ is a *types.Basic with its kind set to types.Int8. 178func HasInt8Kind(typ types.Type) bool { 179 if typ, ok := typ.(*types.Basic); ok { 180 return typ.Kind() == types.Int8 181 } 182 return false 183} 184 185// HasInt16Kind reports whether typ is a *types.Basic with its kind set to types.Int16. 186func HasInt16Kind(typ types.Type) bool { 187 if typ, ok := typ.(*types.Basic); ok { 188 return typ.Kind() == types.Int16 189 } 190 return false 191} 192 193// HasInt32Kind reports whether typ is a *types.Basic with its kind set to types.Int32. 194func HasInt32Kind(typ types.Type) bool { 195 if typ, ok := typ.(*types.Basic); ok { 196 return typ.Kind() == types.Int32 197 } 198 return false 199} 200 201// HasInt64Kind reports whether typ is a *types.Basic with its kind set to types.Int64. 202func HasInt64Kind(typ types.Type) bool { 203 if typ, ok := typ.(*types.Basic); ok { 204 return typ.Kind() == types.Int64 205 } 206 return false 207} 208 209// HasUintKind reports whether typ is a *types.Basic with its kind set to types.Uint. 210func HasUintKind(typ types.Type) bool { 211 if typ, ok := typ.(*types.Basic); ok { 212 return typ.Kind() == types.Uint 213 } 214 return false 215} 216 217// HasUint8Kind reports whether typ is a *types.Basic with its kind set to types.Uint8. 218func HasUint8Kind(typ types.Type) bool { 219 if typ, ok := typ.(*types.Basic); ok { 220 return typ.Kind() == types.Uint8 221 } 222 return false 223} 224 225// HasUint16Kind reports whether typ is a *types.Basic with its kind set to types.Uint16. 226func HasUint16Kind(typ types.Type) bool { 227 if typ, ok := typ.(*types.Basic); ok { 228 return typ.Kind() == types.Uint16 229 } 230 return false 231} 232 233// HasUint32Kind reports whether typ is a *types.Basic with its kind set to types.Uint32. 234func HasUint32Kind(typ types.Type) bool { 235 if typ, ok := typ.(*types.Basic); ok { 236 return typ.Kind() == types.Uint32 237 } 238 return false 239} 240 241// HasUint64Kind reports whether typ is a *types.Basic with its kind set to types.Uint64. 242func HasUint64Kind(typ types.Type) bool { 243 if typ, ok := typ.(*types.Basic); ok { 244 return typ.Kind() == types.Uint64 245 } 246 return false 247} 248 249// HasUintptrKind reports whether typ is a *types.Basic with its kind set to types.Uintptr. 250func HasUintptrKind(typ types.Type) bool { 251 if typ, ok := typ.(*types.Basic); ok { 252 return typ.Kind() == types.Uintptr 253 } 254 return false 255} 256 257// HasFloat32Kind reports whether typ is a *types.Basic with its kind set to types.Float32. 258func HasFloat32Kind(typ types.Type) bool { 259 if typ, ok := typ.(*types.Basic); ok { 260 return typ.Kind() == types.Float32 261 } 262 return false 263} 264 265// HasFloat64Kind reports whether typ is a *types.Basic with its kind set to types.Float64. 266func HasFloat64Kind(typ types.Type) bool { 267 if typ, ok := typ.(*types.Basic); ok { 268 return typ.Kind() == types.Float64 269 } 270 return false 271} 272 273// HasComplex64Kind reports whether typ is a *types.Basic with its kind set to types.Complex64. 274func HasComplex64Kind(typ types.Type) bool { 275 if typ, ok := typ.(*types.Basic); ok { 276 return typ.Kind() == types.Complex64 277 } 278 return false 279} 280 281// HasComplex128Kind reports whether typ is a *types.Basic with its kind set to types.Complex128. 282func HasComplex128Kind(typ types.Type) bool { 283 if typ, ok := typ.(*types.Basic); ok { 284 return typ.Kind() == types.Complex128 285 } 286 return false 287} 288 289// HasStringKind reports whether typ is a *types.Basic with its kind set to types.String. 290func HasStringKind(typ types.Type) bool { 291 if typ, ok := typ.(*types.Basic); ok { 292 return typ.Kind() == types.String 293 } 294 return false 295} 296 297// HasUnsafePointerKind reports whether typ is a *types.Basic with its kind set to types.UnsafePointer. 298func HasUnsafePointerKind(typ types.Type) bool { 299 if typ, ok := typ.(*types.Basic); ok { 300 return typ.Kind() == types.UnsafePointer 301 } 302 return false 303} 304 305// HasUntypedBoolKind reports whether typ is a *types.Basic with its kind set to types.UntypedBool. 306func HasUntypedBoolKind(typ types.Type) bool { 307 if typ, ok := typ.(*types.Basic); ok { 308 return typ.Kind() == types.UntypedBool 309 } 310 return false 311} 312 313// HasUntypedIntKind reports whether typ is a *types.Basic with its kind set to types.UntypedInt. 314func HasUntypedIntKind(typ types.Type) bool { 315 if typ, ok := typ.(*types.Basic); ok { 316 return typ.Kind() == types.UntypedInt 317 } 318 return false 319} 320 321// HasUntypedRuneKind reports whether typ is a *types.Basic with its kind set to types.UntypedRune. 322func HasUntypedRuneKind(typ types.Type) bool { 323 if typ, ok := typ.(*types.Basic); ok { 324 return typ.Kind() == types.UntypedRune 325 } 326 return false 327} 328 329// HasUntypedFloatKind reports whether typ is a *types.Basic with its kind set to types.UntypedFloat. 330func HasUntypedFloatKind(typ types.Type) bool { 331 if typ, ok := typ.(*types.Basic); ok { 332 return typ.Kind() == types.UntypedFloat 333 } 334 return false 335} 336 337// HasUntypedComplexKind reports whether typ is a *types.Basic with its kind set to types.UntypedComplex. 338func HasUntypedComplexKind(typ types.Type) bool { 339 if typ, ok := typ.(*types.Basic); ok { 340 return typ.Kind() == types.UntypedComplex 341 } 342 return false 343} 344 345// HasUntypedStringKind reports whether typ is a *types.Basic with its kind set to types.UntypedString. 346func HasUntypedStringKind(typ types.Type) bool { 347 if typ, ok := typ.(*types.Basic); ok { 348 return typ.Kind() == types.UntypedString 349 } 350 return false 351} 352 353// HasUntypedNilKind reports whether typ is a *types.Basic with its kind set to types.UntypedNil. 354func HasUntypedNilKind(typ types.Type) bool { 355 if typ, ok := typ.(*types.Basic); ok { 356 return typ.Kind() == types.UntypedNil 357 } 358 return false 359} 360