public override QsExpressionKind <TypedExpression, Identifier, ResolvedType> OnIdentifier(Identifier sym, QsNullable <ImmutableArray <ResolvedType> > tArgs) { if (sym is Identifier.GlobalCallable global) { ImmutableConcretion applicableParams = SharedState.CurrentParamTypes .Where(kvp => kvp.Key.Item1.Equals(global.Item)) .ToImmutableDictionary(kvp => kvp.Key, kvp => kvp.Value); // Create a new identifier sym = SharedState.GetConcreteIdentifier(global, applicableParams); tArgs = QsNullable <ImmutableArray <ResolvedType> > .Null; // Remove Type Params used from the CurrentParamTypes foreach (var key in applicableParams.Keys) { SharedState.CurrentParamTypes.Remove(key); } } else if (sym is Identifier.LocalVariable && tArgs.IsValue && tArgs.Item.Any()) { throw new ArgumentException($"Local variables cannot have type arguments."); } return(base.OnIdentifier(sym, tArgs)); }