Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions src/QsCompiler/Transformations/Monomorphization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

namespace Microsoft.Quantum.QsCompiler.Transformations.Monomorphization
{
using Concretion = Dictionary<Tuple<QsQualifiedName, NonNullable<string>>, ResolvedType>;
using GetConcreteIdentifierFunc = Func<Identifier.GlobalCallable, /*ImmutableConcretion*/ ImmutableDictionary<Tuple<QsQualifiedName, NonNullable<string>>, ResolvedType>, Identifier>;
using ImmutableConcretion = ImmutableDictionary<Tuple<QsQualifiedName, NonNullable<string>>, ResolvedType>;
using Concretization = Dictionary<Tuple<QsQualifiedName, NonNullable<string>>, ResolvedType>;
using GetConcreteIdentifierFunc = Func<Identifier.GlobalCallable, /*ImmutableConcretization*/ ImmutableDictionary<Tuple<QsQualifiedName, NonNullable<string>>, ResolvedType>, Identifier>;
using ImmutableConcretization = ImmutableDictionary<Tuple<QsQualifiedName, NonNullable<string>>, ResolvedType>;

/// <summary>
/// This transformation replaces callables with type parameters with concrete
Expand Down Expand Up @@ -90,7 +90,7 @@ public static QsCompilation Apply(QsCompilation compilation)
private static Identifier GetConcreteIdentifier(
Dictionary<ConcreteCallGraphNode, QsQualifiedName> concreteNames,
Identifier.GlobalCallable globalCallable,
ImmutableConcretion types)
ImmutableConcretization types)
{
if (types.IsEmpty)
{
Expand Down Expand Up @@ -182,23 +182,23 @@ public override QsNamespace OnNamespace(QsNamespace ns)
private class ReplaceTypeParamImplementations :
SyntaxTreeTransformation<ReplaceTypeParamImplementations.TransformationState>
{
public static QsCallable Apply(QsCallable callable, ImmutableConcretion typeParams)
public static QsCallable Apply(QsCallable callable, ImmutableConcretization typeParams)
{
var filter = new ReplaceTypeParamImplementations(typeParams);
return filter.Namespaces.OnCallableDeclaration(callable);
}

public class TransformationState
{
public readonly ImmutableConcretion TypeParams;
public readonly ImmutableConcretization TypeParams;

public TransformationState(ImmutableConcretion typeParams)
public TransformationState(ImmutableConcretization typeParams)
{
this.TypeParams = typeParams;
}
}

private ReplaceTypeParamImplementations(ImmutableConcretion typeParams) : base(new TransformationState(typeParams))
private ReplaceTypeParamImplementations(ImmutableConcretization typeParams) : base(new TransformationState(typeParams))
{
this.Namespaces = new NamespaceTransformation(this);
this.Types = new TypeTransformation(this);
Expand Down Expand Up @@ -254,7 +254,7 @@ public static QsCallable Apply(QsCallable current, GetConcreteIdentifierFunc get

public class TransformationState
{
public readonly Concretion CurrentParamTypes = new Concretion();
public readonly Concretization CurrentParamTypes = new Concretization();
public readonly GetConcreteIdentifierFunc GetConcreteIdentifier;
public readonly ImmutableHashSet<QsQualifiedName> IntrinsicCallableSet;

Expand Down Expand Up @@ -295,7 +295,7 @@ public override TypedExpression OnTypedExpression(TypedExpression ex)
return new TypedExpression(kind, typeParamResolutions, exType, inferredInfo, range);
}

public override ImmutableConcretion OnTypeParamResolutions(ImmutableConcretion typeParams)
public override ImmutableConcretization OnTypeParamResolutions(ImmutableConcretization typeParams)
{
// Merge the type params into the current dictionary

Expand All @@ -318,7 +318,7 @@ public override QsExpressionKind<TypedExpression, Identifier, ResolvedType> OnId
{
if (sym is Identifier.GlobalCallable global)
{
ImmutableConcretion applicableParams = this.SharedState.CurrentParamTypes
ImmutableConcretization applicableParams = this.SharedState.CurrentParamTypes
.Where(kvp => kvp.Key.Item1.Equals(global.Item))
.ToImmutableDictionary(kvp => kvp.Key, kvp => kvp.Value);

Expand Down