Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
01b135f
Refactor QSharp.Core into Foundation + Core (#254)
swernli Jun 18, 2020
73e7104
Merging master and fixing up solution file.
swernli Jun 23, 2020
90851b4
Merge pull request #282 from microsoft:swernli/merge-master
swernli Jun 23, 2020
329bcea
Merge remote-tracking branch 'origin/master' into swernli/decomp-merg…
swernli Jul 6, 2020
bea7acb
Merge pull request #296 from microsoft:swernli/decomp-merge-master
swernli Jul 7, 2020
80a9c6d
Merge remote-tracking branch 'origin/master' into swernli/decomp-merg…
swernli Aug 18, 2020
8a88b4e
Merge remote-tracking branch 'origin/master' into swernli/decomp-merg…
swernli Aug 21, 2020
5d670a8
Merge remote-tracking branch 'origin/master' into swernli/decomp-merg…
swernli Aug 21, 2020
2563547
Fixing ResourceEstimator conditional support
swernli Aug 21, 2020
7a37c05
Merge pull request #347 from microsoft/swernli/decomp-merge-master
swernli Aug 21, 2020
e94e9db
Merge remote-tracking branch 'origin/master' into swernli/decomp-merg…
swernli Aug 25, 2020
924aee7
Merge pull request #356 from microsoft/swernli/decomp-merge-master
swernli Aug 25, 2020
1676b4f
Skipping ResourceEstimator tests for targeted Exes
swernli Aug 19, 2020
ca50abe
Create QsharpCore targeting package (#352)
swernli Aug 20, 2020
7130778
Re-enable ResourceEstimator tests
swernli Aug 23, 2020
e35ba6b
Clean up internal operation names.
swernli Aug 26, 2020
078f122
Update src/Simulation/Simulators.Tests/QuantumTestSuite/AssertProbMul…
swernli Aug 26, 2020
d764d9b
Merge pull request #358 from microsoft/swernli/decomp-working2
swernli Aug 27, 2020
7632883
Adding Type2 targeting package and tests (#363)
swernli Sep 4, 2020
9898da5
Merge remote-tracking branch 'origin/master' into swernli/decomp-merg…
swernli Sep 4, 2020
46968b4
Merge pull request #365 from microsoft/swernli/decomp-merge-master
swernli Sep 4, 2020
9a8af05
Fixing csproj QDK versions
swernli Sep 4, 2020
91e2f9e
Merge pull request #366 from microsoft/swernli/decomp-version-fix
swernli Sep 4, 2020
9fda148
Add Type1 target package and simulator support (#367)
swernli Sep 21, 2020
daa957e
Merge remote-tracking branch 'origin/main' into swernli/decomp-merge-…
swernli Sep 22, 2020
4ad13c1
Moving UnsupportedOperationException into Common
swernli Sep 22, 2020
39b273b
Merge pull request #381 from microsoft/swernli/decomp-merge-master
swernli Sep 22, 2020
a45e7c7
Return projects to original paths to fix e2e build
swernli Oct 13, 2020
81948c7
Fix bug in MResetY
swernli Oct 14, 2020
7e057aa
Merge remote-tracking branch 'origin/main' into swernli/decomp-projec…
swernli Oct 14, 2020
ac3a622
Merge pull request #397 from microsoft/swernli/decomp-project-rename
swernli Oct 14, 2020
7c4edd2
Move EmptyArray to QsharpFoundation
swernli Oct 19, 2020
f3752b7
Merge pull request #403 from microsoft/swernli/decomp-fix-e2e
swernli Oct 21, 2020
590d0a6
Merge remote-tracking branch 'origin/main' into swernli/decomp-fix-e2e
swernli Oct 21, 2020
1c4c139
Remove extra project reference
swernli Oct 21, 2020
7b455f6
Merge branch 'feature/decomp' into swernli/decomp-fix-e2e
swernli Oct 21, 2020
85f892c
Merge pull request #405 from microsoft/swernli/decomp-fix-e2e
swernli Oct 21, 2020
07a1af4
Merge remote-tracking branch 'origin/main' into swernli/decomp-fix-e2e
swernli Oct 26, 2020
a365c5f
Fix Reset decomposition capability requirement
swernli Oct 26, 2020
af1ae73
Fix RFrac decomposition to allow negative exponentiation
swernli Oct 26, 2020
cf79eec
Merge pull request #414 from microsoft/swernli/decomp-fix-e2e
swernli Oct 27, 2020
f7d3530
Fixing negative exponentiation in ExpFrac
swernli Oct 27, 2020
cb10e4e
Add Comment about support of negative exponents
swernli Oct 27, 2020
85a516b
Merge branch 'feature/decomp' into swernli/decomp-fix-e2e
swernli Oct 27, 2020
eb4a193
Merge pull request #415 from microsoft/swernli/decomp-fix-e2e
swernli Oct 28, 2020
2d6dc66
Merge remote-tracking branch 'origin/main' into swernli/merge/feature…
swernli Oct 29, 2020
25a1256
Merge branch 'main' into swernli/merge/feature/decomp
swernli Oct 29, 2020
50b404a
Merge branch 'main' into swernli/merge/feature/decomp
swernli Oct 31, 2020
f19dc1e
Merge remote-tracking branch 'origin/main' into swernli/merge/feature…
swernli Nov 5, 2020
626300c
Fix QDK versions after merge from main
swernli Nov 6, 2020
53d204f
Preserve old C# override behavior by default, with opt in for new beh…
swernli Nov 6, 2020
7bd06ac
Removing CheckQubitUniqueness and RotationAngleValidaiton intrinsics
swernli Nov 6, 2020
bba798f
Merge branch 'main' into swernli/merge/feature/decomp
swernli Nov 6, 2020
74acb68
Merge branch 'main' into swernli/merge/feature/decomp
swernli Nov 7, 2020
5644801
Use alternate mechanism for skipping tests
swernli Nov 9, 2020
fde02ad
Merge branch 'main' into swernli/merge/feature/decomp
swernli Nov 9, 2020
02e903c
Captilize random.cs to Random.cs
swernli Nov 9, 2020
742d9a9
Remove supportedRuntime from App.config
swernli Nov 9, 2020
ef53ae7
Adding simple README to TargetDefinitions
swernli Nov 9, 2020
5f39bb1
Merge remote-tracking branch 'origin/main' into swernli/merge/feature…
swernli Nov 16, 2020
a78a750
Merge pull request #442 from microsoft/swernli/merge/feature/decomp
swernli Nov 18, 2020
4c49842
Refactor target packages to use interfaces (#447)
swernli Jan 20, 2021
3557d6d
Merge remote-tracking branch 'origin/main' into swernli/feature/decomp
swernli Jan 21, 2021
580dd7a
Remove abstract-only override flag to allow use of classic override b…
swernli Jan 22, 2021
b84a0e5
Test out returning deprecated simulator classes
swernli Jan 22, 2021
d95c703
Add deprecated placeholders for removed QSim* classes
swernli Jan 22, 2021
7515ccf
Refactor QSharp.Core into Foundation + Core (#254)
swernli Jan 25, 2021
145ab79
Two step rename
swernli Jan 26, 2021
0dc9b20
Second phase of two step rename
swernli Jan 26, 2021
949a37f
Rename Qsharp to QSharp
swernli Jan 26, 2021
ce0114c
Rename Csharp to CSharp
swernli Jan 26, 2021
d5b464b
Fix merge conflicts
swernli Jan 26, 2021
cad7ad5
two stage rename again
swernli Jan 26, 2021
6cec4bc
second part of two part rename, again
swernli Jan 26, 2021
0d123c5
Fix CsharpGeneration namespace name
swernli Jan 27, 2021
a710ec7
Work around notebook dynamic assembly detection
swernli Jan 27, 2021
7b74c87
Merge remote-tracking branch 'origin/main' into swernli/feature/decomp
swernli Jan 27, 2021
a181472
Use EntryPoint to force load core assembly ahead of ResourcesEstimato…
swernli Jan 28, 2021
b6d4588
Try loading assembly for ResourcesEstimator a different way
swernli Jan 28, 2021
f0418fc
Merge branch 'main' into swernli/feature/decomp
swernli Jan 29, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 6 additions & 1 deletion AdvantageBenchmark/privateBuild/host.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.13.20102604">
<Project Sdk="Microsoft.Quantum.Sdk/0.14.2012122063-beta">
<!-- Add project references to Simulator and other required packages: -->
<Import Project="..\..\src\Simulation\Common\Simulators.Dev.props" />

Expand All @@ -8,4 +8,9 @@
<IncludeQSharpCorePackages>false</IncludeQSharpCorePackages> <!-- otherwise the standard library is included by the Sdk -->
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Simulation\Simulators\Microsoft.Quantum.Simulators.csproj" />
<ProjectReference Include="..\..\src\Simulation\QSharpCore\Microsoft.Quantum.QSharp.Core.csproj" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion AdvantageBenchmark/releasedBuild/quantum/quantum.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.13.20102604">
<Project Sdk="Microsoft.Quantum.Sdk/0.14.2012122063-beta">

<ItemGroup>
<QSharpCompile Include="..\..\privateBuild\quantum.qs" />
Expand Down
2 changes: 1 addition & 1 deletion NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2715,7 +2715,7 @@ SOFTWARE.

-------------------------------------------------------------------

Microsoft.Quantum.Compiler 0.12.20082209-beta - MIT
Microsoft.Quantum.Compiler 0.13.20102604 - MIT


(c) 2008 VeriSign, Inc.
Expand Down
1,197 changes: 663 additions & 534 deletions Simulation.sln

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions build/manifest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ $artifacts = @{
"Microsoft.Quantum.Development.Kit",
"Microsoft.Quantum.EntryPointDriver",
"Microsoft.Quantum.QSharp.Core",
"Microsoft.Quantum.Type1.Core",
"Microsoft.Quantum.Type2.Core",
"Microsoft.Quantum.Runtime.Core",
"Microsoft.Quantum.Simulators",
"Microsoft.Quantum.Xunit"
Expand All @@ -37,6 +39,9 @@ $artifacts = @{
".\src\Simulation\Core\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.Runtime.Core.dll",
".\src\Simulation\EntryPointDriver\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.EntryPointDriver.dll",
".\src\Simulation\QSharpCore\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.QSharp.Core.dll",
".\src\Simulation\Type1Core\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.Type1.Core.dll",
".\src\Simulation\Type2Core\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.Type2.Core.dll",
".\src\Simulation\QSharpFoundation\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.QSharp.Foundation.dll",
".\src\Simulation\Simulators\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.Simulation.Common.dll",
".\src\Simulation\Simulators\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.Simulation.QCTraceSimulatorRuntime.dll",
".\src\Simulation\Simulators\bin\$Env:BUILD_CONFIGURATION\netstandard2.1\Microsoft.Quantum.Simulators.dll",
Expand Down
4 changes: 4 additions & 0 deletions build/pack.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ Pack-Dotnet '../src/Azure/Azure.Quantum.Client/Microsoft.Azure.Quantum.Client.cs
Pack-One '../src/Simulation/CSharpGeneration/Microsoft.Quantum.CSharpGeneration.fsproj' '-IncludeReferencedProjects'
Pack-Dotnet '../src/Simulation/EntryPointDriver/Microsoft.Quantum.EntryPointDriver.csproj'
Pack-Dotnet '../src/Simulation/Core/Microsoft.Quantum.Runtime.Core.csproj'
Pack-Dotnet '../src/Simulation/TargetDefinitions/Interfaces/Microsoft.Quantum.Targets.Interfaces.csproj'
Pack-Dotnet '../src/Simulation/QSharpFoundation/Microsoft.Quantum.QSharp.Foundation.csproj'
Pack-Dotnet '../src/Simulation/QSharpCore/Microsoft.Quantum.QSharp.Core.csproj'
Pack-Dotnet '../src/Simulation/Type1Core/Microsoft.Quantum.Type1.Core.csproj'
Pack-Dotnet '../src/Simulation/Type2Core/Microsoft.Quantum.Type2.Core.csproj'
Pack-One '../src/Simulation/Simulators/Microsoft.Quantum.Simulators.nuspec'
Pack-One '../src/Quantum.Development.Kit/Microsoft.Quantum.Development.Kit.nuspec'
Pack-One '../src/Xunit/Microsoft.Quantum.Xunit.csproj'
Expand Down
4 changes: 2 additions & 2 deletions src/Simulation/CSharpGeneration.Tests/SimulationCodeTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1710,7 +1710,7 @@ namespace N1

let testOneSpecialization pick (_,op) expected =
let context = createTestContext op
let actual = op |> pick |> buildSpecialization context |> Option.map (fst >> formatSyntaxTree)
let actual = op |> pick |> buildSpecialization context op |> Option.map (fst >> formatSyntaxTree)
Assert.Equal(expected |> Option.map clearFormatting, actual |> Option.map clearFormatting)

[<Fact>]
Expand Down Expand Up @@ -2315,7 +2315,7 @@ namespace N1
[<Fact>]
let ``is abstract`` () =
let testOne (_,op) expected =
let actual = op |> isAbstract
let actual = op |> isIntrinsic
Assert.Equal(expected, actual)

true |> testOne emptyOperation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,9 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Core\Microsoft.Quantum.Runtime.Core.csproj" />
<ProjectReference Include="..\CSharpGeneration\Microsoft.Quantum.CSharpGeneration.fsproj" />
<ProjectReference Include="..\QSharpCore\Microsoft.Quantum.QSharp.Core.csproj" />
<ProjectReference Include="..\Simulators\Microsoft.Quantum.Simulators.csproj" />
<ProjectReference Include="..\QSharpCore\Microsoft.Quantum.QSharp.Core.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<ItemGroup>
<PackageReference Update="FSharp.Core" Version="4.7.0" />
<PackageReference Include="Microsoft.Quantum.Compiler" Version="0.13.2011.802-alpha" />
<PackageReference Include="Microsoft.Quantum.Compiler" Version="0.14.2012122063-beta" />
</ItemGroup>

<ItemGroup>
Expand Down
154 changes: 112 additions & 42 deletions src/Simulation/CSharpGeneration/SimulationCode.fs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ module SimulationCode =
"Microsoft.Quantum.Simulation.Core"
]

let autoNamespacesWithInterfaces =
[
"System"
"Microsoft.Quantum.Core"
"Microsoft.Quantum.Intrinsic"
"Microsoft.Quantum.Intrinsic.Interfaces"
"Microsoft.Quantum.Simulation.Core"
]

let funcsAsProps = [
("Length", { Namespace = "Microsoft.Quantum.Core"; Name = "Length" } )
("Start", { Namespace = "Microsoft.Quantum.Core"; Name = "RangeStart" } )
Expand All @@ -69,16 +78,24 @@ module SimulationCode =
let prependNamespaceString (name : QsQualifiedName) =
name.Namespace.Replace (".", "__") + "__" + name.Name

let isConcreteIntrinsic (context:CodegenContext) =
match context.assemblyConstants.TryGetValue AssemblyConstants.GenerateConcreteIntrinsic with
| true, "false" -> false
| true, _ -> true
| false, _ -> false

let needsFullPath context (op:QsQualifiedName) =
let hasMultipleDefinitions() = if context.byName.ContainsKey op.Name then context.byName.[op.Name].Length > 1 else false
let sameNamespace = match context.current with | None -> false | Some n -> n.Namespace = op.Namespace

let namespaces = if isConcreteIntrinsic context then autoNamespacesWithInterfaces else autoNamespaces

if sameNamespace then
false
elif hasMultipleDefinitions() then
true
else
not (autoNamespaces |> List.contains op.Namespace)
not (namespaces |> List.contains op.Namespace)

let getOpName context n =
if isCurrentOp context n then Directives.Self
Expand Down Expand Up @@ -913,6 +930,18 @@ module SimulationCode =
``{`` [] ``}``
:> MemberDeclarationSyntax

/// Returns the constructor for the given intrinsic operation.
let buildIntrinsicConstructor context name : MemberDeclarationSyntax =
``constructor`` name ``(`` [ ("m", ``type`` "IOperationFactory") ] ``)``
``:`` [ "m" ]
[ ``public`` ]
``{``
[
(``ident`` "this") <|.|> (``ident`` "Gate") <-- (``ident`` "m") |~> ("IGate_" + name) |> statement
]
``}``
:> MemberDeclarationSyntax

/// For each Operation used in the given OperationDeclartion, returns
/// a Property that returns an instance of the operation by calling the
/// IOperationFactory
Expand Down Expand Up @@ -957,41 +986,33 @@ module SimulationCode =
(``=>`` newInstance)
:> MemberDeclarationSyntax

let buildSpecializationBody context (sp:QsSpecialization) =
let buildSpecializationBody (context:CodegenContext) (op:QsCallable) (sp:QsSpecialization) =
let getInputVarWithInit args =
let inData = ``ident`` "__in__"
let name = function | ValidName n -> n | InvalidName -> ""
let rec buildVariableName = function
| QsTupleItem one -> one.VariableName |> name
| QsTuple many -> "(" + (many |> Seq.map buildVariableName |> String.concat ",") + ")"
match args with
| QsTupleItem one -> (one.VariableName |> name, [])
| QsTuple many ->
if many.Length = 0 then
("__in__", [])
elif many.Length = 1 then
("__in__", [ ``var`` (buildVariableName many.[0]) (``:=`` <| inData) ])
else
("__in__", [ ``var`` (buildVariableName args) (``:=`` <| inData) ])
match sp.Implementation with
| Provided (args, _) ->
let returnType = sp.Signature.ReturnType
let argName, argsInit = getInputVarWithInit args
let statements =
let builder = new SyntaxBuilder(context)
builder.Namespaces.OnSpecializationDeclaration sp |> ignore
builder.BuiltStatements

let inData = ``ident`` "__in__"
let ret =
match returnType.Resolution with
| QsTypeKind.UnitType ->
[
``#line hidden`` <|
``return`` ( Some ((``ident`` "QVoid") <|.|> (``ident`` "Instance")) )
]
| _ ->
[]
let (argName, argsInit) =
//TODO: diagnostics.
let name = function | ValidName n -> n | InvalidName -> ""
let rec buildVariableName = function
| QsTupleItem one -> one.VariableName |> name
| QsTuple many -> "(" + (many |> Seq.map buildVariableName |> String.concat ",") + ")"
match args with
| QsTupleItem one -> (one.VariableName |> name, [])
| QsTuple many ->
if many.Length = 0 then
("__in__", [])
elif many.Length = 1 then
("__in__", [ ``var`` (buildVariableName many.[0]) (``:=`` <| inData) ])
else
("__in__", [ ``var`` (buildVariableName args) (``:=`` <| inData) ])

match sp.Signature.ReturnType.Resolution with
| QsTypeKind.UnitType -> [ ``return`` ( Some ((``ident`` "QVoid") <|.|> (``ident`` "Instance")) ) |> ``#line hidden`` ]
| _ -> []
Some (``() => {}`` [ argName ] (argsInit @ statements @ ret) :> ExpressionSyntax)
| Generated SelfInverse ->
let adjointedBodyName =
Expand All @@ -1001,10 +1022,50 @@ module SimulationCode =
//TODO: diagnostics.
| _ -> "__Body__"
Some (``ident`` adjointedBodyName :> ExpressionSyntax)
| Intrinsic when isConcreteIntrinsic context ->
// Add in the control qubits parameter when dealing with a controlled spec
let args =
match sp.Kind with
| QsControlled | QsControlledAdjoint ->
let ctlVar =
let name = ValidName("__controlQubits__")
let varType = Qubit |> ResolvedType.New |> ArrayType |> ResolvedType.New
let info = InferredExpressionInformation.New(false, false)
let pos = QsNullable<Position>.Null
let range = Range.Zero
{VariableName = name; Type = varType; InferredInformation = info; Position = pos; Range = range}
match op.ArgumentTuple with
| QsTuple many when many.Length = 1 ->
QsTuple(ImmutableArray.Create(QsTupleItem(ctlVar), many.[0]))
| _ -> QsTuple(ImmutableArray.Create(QsTupleItem(ctlVar), op.ArgumentTuple))
| _ -> op.ArgumentTuple
let argName, argsInit = getInputVarWithInit args
let specCall =
(userDefinedName None op.FullName.Name) + "__" +
match sp.Kind with
| QsBody -> ""
| QsAdjoint -> "Adjoint"
| QsControlled -> "Controlled"
| QsControlledAdjoint -> "ControlledAdjoint"
+ "Body"
let name = function | ValidName n -> ``ident`` n | InvalidName -> ``ident`` ""
let rec argsToVars = function
| QsTupleItem one -> [one.VariableName |> name]
| QsTuple many -> many |> Seq.map argsToVars |> List.concat
let callExp = (``ident`` "Gate") <.> (``ident`` specCall, argsToVars args)
let statements =
match sp.Signature.ReturnType.Resolution with
| QsTypeKind.UnitType ->
[
callExp |> statement
``return`` ( Some ((``ident`` "QVoid") <|.|> (``ident`` "Instance")) ) |> ``#line hidden``
]
| _ -> [ ``return`` ( Some callExp ) ]
Some (``() => {}`` [ argName ] (argsInit @ statements) :> ExpressionSyntax)
| _ ->
None

let buildSpecialization context (sp:QsSpecialization) : (PropertyDeclarationSyntax * _) option =
let buildSpecialization context (op:QsCallable) (sp:QsSpecialization) : (PropertyDeclarationSyntax * _) option =
let inType = roslynTypeName context sp.Signature.ArgumentType
let outType = roslynTypeName context sp.Signature.ReturnType
let propertyType = "Func<" + inType + ", " + outType + ">"
Expand All @@ -1014,7 +1075,7 @@ module SimulationCode =
| QsAdjoint -> "Adjoint"
| QsControlled -> "Controlled"
| QsControlledAdjoint -> "ControlledAdjoint"
let body = buildSpecializationBody context sp
let body = buildSpecializationBody context op sp
let attributes =
match sp.Location with
| Null -> []
Expand Down Expand Up @@ -1217,6 +1278,10 @@ module SimulationCode =
``get`` (``=>`` (``literal`` name) )
:> MemberDeclarationSyntax

let buildGate name =
``propg`` ("IGate_" + name) "Gate" [ ``private``; ``protected`` ]
:> MemberDeclarationSyntax

let buildFullName (name : QsQualifiedName) =
let fqn =
let ns = name.Namespace
Expand Down Expand Up @@ -1336,7 +1401,7 @@ module SimulationCode =
let nonGeneric = if typeParameters.IsEmpty then name else sprintf "%s<%s>" name (String.Join(",", typeParameters))
(name, nonGeneric)

let isAbstract op =
let isIntrinsic op =
let isBody (sp:QsSpecialization) = match sp.Kind with | QsBody when sp.Implementation <> Intrinsic -> true | _ -> false
not (op.Specializations |> Seq.exists isBody)

Expand Down Expand Up @@ -1385,16 +1450,20 @@ module SimulationCode =
let opNames = operationDependencies op
let inType = op.Signature.ArgumentType |> roslynTypeName context
let outType = op.Signature.ReturnType |> roslynTypeName context
let opIsIntrinsic = isIntrinsic op
let isConcreteIntrinsic = opIsIntrinsic && isConcreteIntrinsic context

let constructors = [ (buildConstructor context name) ]
let constructors = [ ((if isConcreteIntrinsic then buildIntrinsicConstructor else buildConstructor) context name) ]
let properties =
let opProperties = buildOpsProperties context opNames
buildName name ::
buildFullName context.current.Value ::
if globalContext.entryPoints |> Seq.contains op.FullName then
buildOperationInfoProperty globalContext inType outType nonGenericName ::
opProperties
else opProperties
[
yield buildName name
yield buildFullName context.current.Value
if globalContext.entryPoints |> Seq.contains op.FullName then
yield buildOperationInfoProperty globalContext inType outType nonGenericName
if isConcreteIntrinsic then yield buildGate name
yield! opProperties
]

let baseOp =
if isFunction op then
Expand All @@ -1411,7 +1480,7 @@ module SimulationCode =
let typeParameters = typeParametersNames op.Signature
let baseClass = genericBase baseOp ``<<`` typeArgsInterface ``>>``
let bodies, attr =
op.Specializations |> Seq.map (buildSpecialization context) |> Seq.choose id |> Seq.toList
op.Specializations |> Seq.map (buildSpecialization context op) |> Seq.choose id |> Seq.toList
|> List.map (fun (x, y) -> (x :> MemberDeclarationSyntax, y)) |> List.unzip
let inData = (buildDataWrapper context "In" op.Signature.ArgumentType)
let outData = (buildDataWrapper context "Out" op.Signature.ReturnType)
Expand Down Expand Up @@ -1441,7 +1510,7 @@ module SimulationCode =

let modifiers =
let access = classAccessModifier op.Modifiers.Access
if isAbstract op then
if opIsIntrinsic && not isConcreteIntrinsic then
[ access; ``abstract``; ``partial`` ]
else
[ access; ``partial`` ]
Expand Down Expand Up @@ -1625,7 +1694,8 @@ module SimulationCode =

// Builds the C# syntaxTree for the Q# elements defined in the given file.
let buildSyntaxTree localElements (context : CodegenContext) =
let usings = autoNamespaces |> List.map (fun ns -> ``using`` ns)
let namespaces = if isConcreteIntrinsic context then autoNamespacesWithInterfaces else autoNamespaces
let usings = namespaces |> List.map (fun ns -> ``using`` ns)
let attributes = localElements |> List.map (snd >> buildDeclarationAttributes) |> List.concat
let namespaces = localElements |> List.map (buildNamespace context)

Expand Down
6 changes: 6 additions & 0 deletions src/Simulation/Common/AssemblyCommon.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
<Authors>Microsoft</Authors>
<Product>Microsoft Quantum Development Kit Preview</Product>
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
<PackageReleaseNotes>See: https://docs.microsoft.com/en-us/quantum/relnotes/</PackageReleaseNotes>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<ProjectUrl>https://docs.microsoft.com/quantum/</ProjectUrl>
<PackageProjectUrl>https://github.com/microsoft/qsharp-runtime</PackageProjectUrl>
<PackageIcon>qdk-nuget-icon.png</PackageIcon>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
</PropertyGroup>

<!--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

<ItemGroup>
<ProjectReference Include="..\Core\Microsoft.Quantum.Runtime.Core.csproj" />
<ProjectReference Include="..\QSharpCore\Microsoft.Quantum.QSharp.Core.csproj" />
</ItemGroup>

</Project>
Loading