/// <summary>
                /// Get the combined type resolutions for a pair of nested resolutions,
                /// resolving references in the inner resolutions to the outer resolutions.
                /// </summary>
                private TypeArgsResolution GetCombinedTypeResolution(TypeArgsResolution outer, TypeArgsResolution inner)
                {
                    var outerDict = outer.ToDictionary(x => (x.Item1, x.Item2), x => x.Item3);

                    return(inner.Select(innerRes =>
                    {
                        if (innerRes.Item3.Resolution is ResolvedTypeKind.TypeParameter typeParam &&
                            outerDict.TryGetValue((typeParam.Item.Origin, typeParam.Item.TypeName), out var outerRes))
                        {
                            outerDict.Remove((typeParam.Item.Origin, typeParam.Item.TypeName));
                            return Tuple.Create(innerRes.Item1, innerRes.Item2, outerRes);
                        }
 internal static TypedExpression CreateIdentifierExpression(Identifier id,
                                                            TypeArgsResolution typeArgsMapping, ResolvedType resolvedType) =>
 new TypedExpression
 (
     ExpressionKind.NewIdentifier(
         id,
         typeArgsMapping.Any()
             ? QsNullable <ImmutableArray <ResolvedType> > .NewValue(typeArgsMapping
                                                                     .Select(argMapping => argMapping.Item3) // This should preserve the order of the type args
                                                                     .ToImmutableArray())
             : QsNullable <ImmutableArray <ResolvedType> > .Null),
     typeArgsMapping,
     resolvedType,
     new InferredExpressionInformation(false, false),
     QsNullable <Tuple <QsPositionInfo, QsPositionInfo> > .Null
 );
 internal static TypedExpression CreateCallLikeExpression(TypedExpression id, TypedExpression args, TypeArgsResolution typeRes) =>
 new TypedExpression
 (
     ExpressionKind.NewCallLikeExpression(id, args),
     typeRes,
     ResolvedType.New(ResolvedTypeKind.UnitType),
     new InferredExpressionInformation(false, true),
     QsNullable <Tuple <QsPositionInfo, QsPositionInfo> > .Null
 );