public override QsTypeKind <ResolvedType, UserDefinedType, QsTypeParameter, CallableInformation> OnTypeParameter(QsTypeParameter tp) { if (this.SharedState.CurrentParamTypes.TryGetValue(Tuple.Create(tp.Origin, tp.TypeName), out var typeParam)) { return(typeParam.Resolution); } return(QsTypeKind <ResolvedType, UserDefinedType, QsTypeParameter, CallableInformation> .NewTypeParameter(tp)); }
public override QsTypeKind onTypeParameter(QsTypeParameter tp) { this.CodeOutput.onTypeParameter(tp); var tpName = NonNullable <string> .New(this.CodeOutput.Output ?? ""); this.OnIdentifier?.Invoke(Identifier.NewLocalVariable(tpName), tp.Range); return(QsTypeKind.NewTypeParameter(tp)); }
// If an intrinsic callable is generic, then its type parameters can occur within expressions; // when generic intrinsics are called, the type of that call contains type parameter types. public override QsTypeKind <ResolvedType, UserDefinedType, QsTypeParameter, CallableInformation> OnTypeParameter(QsTypeParameter tp) => this.SharedState.IntrinsicCallableSet.Contains(tp.Origin) ? QsTypeKind <ResolvedType, UserDefinedType, QsTypeParameter, CallableInformation> .NewTypeParameter(tp) : throw new Exception("Type Parameter types must be resolved");