This repository was archived by the owner on Jan 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 90
QEP 2: Enhanced Array Literals #643
Merged
Merged
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
6eaac54
Add C# gen for sized array
5ad7f75
Implement QArray.Repeat
ad01b34
Add more array tests
b41ed0f
Add doc comments
d21c679
More efficient array creation
eeb5715
Remove TODO, leave exception type untested
3ac7a0b
Formatting
268c94b
Merge branch 'main' into samarsha/sized-array
bamarsha 5158e4a
Update packages
0474318
Add tests for ref counts in array-of-arrays
6fe98bf
Capture value expression
e7bdfd9
Undo QscVerbosity
51f1aaf
Clean up QArrayInner.Extend
588d499
Increment ref count N times
71102e6
Add comment about exception type
fa4f62a
Merge pull request #507 from microsoft/samarsha/sized-array
bamarsha 6ec8be9
Merge branch 'main' into samarsha/qep2-main
20c19d5
Merge pull request #563 from microsoft/samarsha/qep2-main
bamarsha 92ee05e
Update packages
ccfd394
Fix partial application code gen test
b9c49cc
Merge branch 'main' into samarsha/qep2-main
9f0a231
Merge branch 'main' into samarsha/qep2-main
5efa4e2
Update SDK package
07ffdc2
Update Microsoft.Quantum.CSharpGeneration.fsproj
bamarsha da2190a
Merge pull request #611 from microsoft/samarsha/qep2-main
bamarsha 3c87036
Merge branch 'feature/qep2' into samarsha/hm
bamarsha f85c039
Update Microsoft.Quantum.CSharpGeneration.fsproj
bamarsha 7ae6a9b
Merge pull request #567 from microsoft/samarsha/hm
bamarsha 099a257
Update C# generation tests for microsoft/qsharp-compiler#952
b309edc
Merge pull request #621 from microsoft/samarsha/update-deprecated-ranges
bamarsha ef8f96f
Merge branch 'main' into samarsha/qep2-main
369e775
Merge pull request #641 from microsoft/samarsha/qep2-main
bamarsha 47e0620
Merge branch 'main' into samarsha/qep2
bamarsha 7a68577
Update global.json
bamarsha 80d582e
Merge branch 'main' into samarsha/qep2
bamarsha 28b2d1c
Merge branch 'main' into samarsha/qep2
bettinaheim File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| { | ||
| "msbuild-sdks": { | ||
| "Microsoft.Quantum.Sdk": "0.15.210425594-alpha" | ||
| "Microsoft.Quantum.Sdk": "0.15.210425813-alpha" | ||
| } | ||
| } |
61 changes: 34 additions & 27 deletions
61
src/Simulation/CSharpGeneration.Tests/SimulationCodeTests.fs
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../QCTraceSimulator.Tests/Tests.Microsoft.Quantum.Simulation.QCTraceSimulatorRuntime.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/Simulation/QSharpFoundation/Microsoft.Quantum.QSharp.Foundation.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| namespace Microsoft.Quantum.Simulation.Simulators.Tests.Circuits { | ||
| open Microsoft.Quantum.Diagnostics; | ||
| open Microsoft.Quantum.Intrinsic; | ||
|
|
||
| operation MapF<'T, 'U>(mapper : ('T -> 'U), source : 'T[]) : 'U[] { | ||
| mutable result = new 'U[Length(source)]; | ||
| for (i in 0 .. Length(source) - 1) { | ||
| let m = mapper(source[i]); | ||
| set result = result w/ i <- m; | ||
| } | ||
|
|
||
| return result; | ||
| } | ||
|
|
||
| operation LengthTest() : Unit { | ||
| let a1 = [One, Zero]; | ||
| let a2 = [Zero, Zero, Zero]; | ||
|
|
||
| AssertEqual(2, Length(a1)); | ||
| AssertEqual(3, Length(a2)); | ||
|
|
||
| let values = MapF(Length<Result>, [a1, a2]); | ||
| AssertEqual(2, values[0]); | ||
| AssertEqual(3, values[1]); | ||
| } | ||
|
|
||
| @Test("QuantumSimulator") | ||
| function CreateArrayWithPositiveSize() : Unit { | ||
| let xs = [true, size = 3]; | ||
| AssertEqual([true, true, true], xs); | ||
| } | ||
|
|
||
| @Test("QuantumSimulator") | ||
| function CreateArrayWithZeroSize() : Unit { | ||
| let xs = [true, size = 0]; | ||
| AssertEqual(0, Length(xs)); | ||
| } | ||
|
|
||
| function CreateArrayWithNegativeSize() : Bool[] { | ||
| return [true, size = -1]; | ||
| } | ||
|
|
||
| @Test("QuantumSimulator") | ||
| function CreateArrayWithSizeExpression() : Unit { | ||
| let n = 2; | ||
| let xs = [7, size = n + 1]; | ||
| AssertEqual([7, 7, 7], xs); | ||
| } | ||
|
|
||
| @Test("QuantumSimulator") | ||
| function CreateArrayWithValueExpression() : Unit { | ||
| let x = "foo"; | ||
| let xs = [x + "bar", size = 3]; | ||
| AssertEqual(["foobar", "foobar", "foobar"], xs); | ||
| } | ||
|
|
||
| @Test("QuantumSimulator") | ||
| function SizedArrayShouldIncrementArrayItemRefCount() : Unit { | ||
| mutable item = [1]; | ||
| let items = [item, size = 2]; | ||
| set item w/= 0 <- 2; | ||
|
|
||
| AssertEqual([2], item); | ||
| AssertEqual([[1], [1]], items); | ||
| } | ||
|
|
||
| @Test("QuantumSimulator") | ||
| function ArrayOfArraysShouldCopyOnUpdate() : Unit { | ||
| mutable items = [[1], size = 2]; | ||
| set items w/= 0 <- items[0] w/ 0 <- 2; | ||
|
|
||
| AssertEqual([[2], [1]], items); | ||
| } | ||
| } |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/Simulation/Simulators.Tests/TestProjects/HoneywellExe/HoneywellExe.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/Simulation/Simulators.Tests/TestProjects/IntrinsicTests/IntrinsicTests.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/Simulation/Simulators.Tests/TestProjects/IonQExe/IonQExe.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/Simulation/Simulators.Tests/TestProjects/Library with Spaces/Library with Spaces.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/Simulation/Simulators.Tests/TestProjects/Library1/Library1.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/Simulation/Simulators.Tests/TestProjects/Library2/Library2.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/Simulation/Simulators.Tests/TestProjects/QCIExe/QCIExe.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/Simulation/Simulators.Tests/TestProjects/QSharpExe/QSharpExe.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/Simulation/Simulators.Tests/TestProjects/TargetedExe/TargetedExe.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/Simulation/Simulators.Tests/TestProjects/UnitTests/UnitTests.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/Simulation/Simulators.Tests/Tests.Microsoft.Quantum.Simulators.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/Simulation/Simulators.Type1.Tests/Tests.Microsoft.Quantum.Simulators.Type1.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/Simulation/Simulators.Type2.Tests/Tests.Microsoft.Quantum.Simulators.Type2.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.