qsharp-lang 1.6.1-dev → 1.6.2-dev

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (281) hide show
  1. package/dist/browser.d.ts +4 -8
  2. package/dist/browser.js +4 -4
  3. package/dist/compiler/compiler.d.ts +20 -37
  4. package/dist/compiler/compiler.js +30 -50
  5. package/dist/debug-service/debug-service.d.ts +3 -3
  6. package/dist/debug-service/debug-service.js +4 -3
  7. package/dist/katas-content.generated.js +28 -8
  8. package/dist/katas-content.generated.md.js +28 -8
  9. package/dist/language-service/language-service.d.ts +3 -4
  10. package/dist/language-service/language-service.js +8 -3
  11. package/dist/main.d.ts +3 -6
  12. package/dist/main.js +4 -4
  13. package/docs/Microsoft.Quantum.Arrays/All.md +1 -1
  14. package/docs/Microsoft.Quantum.Arrays/Any.md +1 -1
  15. package/docs/Microsoft.Quantum.Arrays/Chunks.md +1 -1
  16. package/docs/Microsoft.Quantum.Arrays/CircularlyShifted.md +1 -1
  17. package/docs/Microsoft.Quantum.Arrays/ColumnAt.md +1 -1
  18. package/docs/Microsoft.Quantum.Arrays/Count.md +1 -1
  19. package/docs/Microsoft.Quantum.Arrays/Diagonal.md +1 -1
  20. package/docs/Microsoft.Quantum.Arrays/DrawMany.md +1 -1
  21. package/docs/Microsoft.Quantum.Arrays/Enumerated.md +1 -1
  22. package/docs/Microsoft.Quantum.Arrays/Excluding.md +1 -1
  23. package/docs/Microsoft.Quantum.Arrays/Filtered.md +1 -1
  24. package/docs/Microsoft.Quantum.Arrays/FlatMapped.md +1 -1
  25. package/docs/Microsoft.Quantum.Arrays/Flattened.md +1 -1
  26. package/docs/Microsoft.Quantum.Arrays/Fold.md +1 -1
  27. package/docs/Microsoft.Quantum.Arrays/ForEach.md +1 -1
  28. package/docs/Microsoft.Quantum.Arrays/Head.md +1 -1
  29. package/docs/Microsoft.Quantum.Arrays/HeadAndRest.md +1 -1
  30. package/docs/Microsoft.Quantum.Arrays/IndexOf.md +1 -1
  31. package/docs/Microsoft.Quantum.Arrays/IndexRange.md +1 -1
  32. package/docs/Microsoft.Quantum.Arrays/Interleaved.md +1 -1
  33. package/docs/Microsoft.Quantum.Arrays/IsEmpty.md +1 -1
  34. package/docs/Microsoft.Quantum.Arrays/IsRectangularArray.md +1 -1
  35. package/docs/Microsoft.Quantum.Arrays/IsSorted.md +1 -1
  36. package/docs/Microsoft.Quantum.Arrays/IsSquareArray.md +1 -1
  37. package/docs/Microsoft.Quantum.Arrays/Mapped.md +1 -1
  38. package/docs/Microsoft.Quantum.Arrays/MappedByIndex.md +1 -1
  39. package/docs/Microsoft.Quantum.Arrays/MappedOverRange.md +1 -1
  40. package/docs/Microsoft.Quantum.Arrays/Most.md +1 -1
  41. package/docs/Microsoft.Quantum.Arrays/MostAndTail.md +1 -1
  42. package/docs/Microsoft.Quantum.Arrays/Padded.md +1 -1
  43. package/docs/Microsoft.Quantum.Arrays/Partitioned.md +1 -1
  44. package/docs/Microsoft.Quantum.Arrays/Rest.md +1 -1
  45. package/docs/Microsoft.Quantum.Arrays/Reversed.md +1 -1
  46. package/docs/Microsoft.Quantum.Arrays/SequenceI.md +1 -1
  47. package/docs/Microsoft.Quantum.Arrays/SequenceL.md +1 -1
  48. package/docs/Microsoft.Quantum.Arrays/Sorted.md +1 -1
  49. package/docs/Microsoft.Quantum.Arrays/Subarray.md +1 -1
  50. package/docs/Microsoft.Quantum.Arrays/Swapped.md +1 -1
  51. package/docs/Microsoft.Quantum.Arrays/Tail.md +1 -1
  52. package/docs/Microsoft.Quantum.Arrays/Transposed.md +1 -1
  53. package/docs/Microsoft.Quantum.Arrays/Unzipped.md +1 -1
  54. package/docs/Microsoft.Quantum.Arrays/Where.md +1 -1
  55. package/docs/Microsoft.Quantum.Arrays/Windows.md +1 -1
  56. package/docs/Microsoft.Quantum.Arrays/Zipped.md +1 -1
  57. package/docs/Microsoft.Quantum.Canon/ApplyCNOTChain.md +1 -1
  58. package/docs/Microsoft.Quantum.Canon/ApplyControlledOnBitString.md +1 -1
  59. package/docs/Microsoft.Quantum.Canon/ApplyControlledOnInt.md +1 -1
  60. package/docs/Microsoft.Quantum.Canon/ApplyP.md +1 -1
  61. package/docs/Microsoft.Quantum.Canon/ApplyPauli.md +1 -1
  62. package/docs/Microsoft.Quantum.Canon/ApplyPauliFromBitString.md +1 -1
  63. package/docs/Microsoft.Quantum.Canon/ApplyPauliFromInt.md +1 -1
  64. package/docs/Microsoft.Quantum.Canon/ApplyQFT.md +1 -1
  65. package/docs/Microsoft.Quantum.Canon/ApplyToEach.md +1 -1
  66. package/docs/Microsoft.Quantum.Canon/ApplyToEachA.md +1 -1
  67. package/docs/Microsoft.Quantum.Canon/ApplyToEachC.md +1 -1
  68. package/docs/Microsoft.Quantum.Canon/ApplyToEachCA.md +1 -1
  69. package/docs/Microsoft.Quantum.Canon/ApplyXorInPlace.md +1 -1
  70. package/docs/Microsoft.Quantum.Canon/ApplyXorInPlaceL.md +1 -1
  71. package/docs/Microsoft.Quantum.Canon/CX.md +1 -1
  72. package/docs/Microsoft.Quantum.Canon/CY.md +1 -1
  73. package/docs/Microsoft.Quantum.Canon/CZ.md +1 -1
  74. package/docs/Microsoft.Quantum.Canon/Fst.md +1 -1
  75. package/docs/Microsoft.Quantum.Canon/Snd.md +1 -1
  76. package/docs/Microsoft.Quantum.Canon/SwapReverseRegister.md +1 -1
  77. package/docs/Microsoft.Quantum.Convert/BigIntAsBoolArray.md +1 -1
  78. package/docs/Microsoft.Quantum.Convert/BoolArrayAsBigInt.md +1 -1
  79. package/docs/Microsoft.Quantum.Convert/BoolArrayAsInt.md +1 -1
  80. package/docs/Microsoft.Quantum.Convert/BoolArrayAsResultArray.md +1 -1
  81. package/docs/Microsoft.Quantum.Convert/BoolAsResult.md +1 -1
  82. package/docs/Microsoft.Quantum.Convert/ComplexAsComplexPolar.md +1 -1
  83. package/docs/Microsoft.Quantum.Convert/ComplexPolarAsComplex.md +1 -1
  84. package/docs/Microsoft.Quantum.Convert/IntAsBigInt.md +1 -1
  85. package/docs/Microsoft.Quantum.Convert/IntAsBoolArray.md +1 -1
  86. package/docs/Microsoft.Quantum.Convert/IntAsDouble.md +1 -1
  87. package/docs/Microsoft.Quantum.Convert/ResultArrayAsBoolArray.md +1 -1
  88. package/docs/Microsoft.Quantum.Convert/ResultArrayAsInt.md +1 -1
  89. package/docs/Microsoft.Quantum.Convert/ResultAsBool.md +1 -1
  90. package/docs/Microsoft.Quantum.Core/IsRangeEmpty.md +1 -1
  91. package/docs/Microsoft.Quantum.Core/Length.md +1 -1
  92. package/docs/Microsoft.Quantum.Core/RangeEnd.md +1 -1
  93. package/docs/Microsoft.Quantum.Core/RangeReverse.md +1 -1
  94. package/docs/Microsoft.Quantum.Core/RangeStart.md +1 -1
  95. package/docs/Microsoft.Quantum.Core/RangeStep.md +1 -1
  96. package/docs/Microsoft.Quantum.Core/Repeated.md +1 -1
  97. package/docs/Microsoft.Quantum.Diagnostics/DumpMachine.md +1 -1
  98. package/docs/Microsoft.Quantum.Diagnostics/DumpRegister.md +1 -1
  99. package/docs/Microsoft.Quantum.Diagnostics/Fact.md +1 -1
  100. package/docs/Microsoft.Quantum.Intrinsic/AND.md +1 -1
  101. package/docs/Microsoft.Quantum.Intrinsic/CCNOT.md +1 -1
  102. package/docs/Microsoft.Quantum.Intrinsic/CNOT.md +1 -1
  103. package/docs/Microsoft.Quantum.Intrinsic/Exp.md +1 -1
  104. package/docs/Microsoft.Quantum.Intrinsic/H.md +1 -1
  105. package/docs/Microsoft.Quantum.Intrinsic/I.md +1 -1
  106. package/docs/Microsoft.Quantum.Intrinsic/M.md +1 -1
  107. package/docs/Microsoft.Quantum.Intrinsic/Measure.md +1 -1
  108. package/docs/Microsoft.Quantum.Intrinsic/Message.md +1 -1
  109. package/docs/Microsoft.Quantum.Intrinsic/R.md +1 -1
  110. package/docs/Microsoft.Quantum.Intrinsic/R1.md +1 -1
  111. package/docs/Microsoft.Quantum.Intrinsic/R1Frac.md +1 -1
  112. package/docs/Microsoft.Quantum.Intrinsic/RFrac.md +1 -1
  113. package/docs/Microsoft.Quantum.Intrinsic/Reset.md +1 -1
  114. package/docs/Microsoft.Quantum.Intrinsic/ResetAll.md +1 -1
  115. package/docs/Microsoft.Quantum.Intrinsic/Rx.md +1 -1
  116. package/docs/Microsoft.Quantum.Intrinsic/Rxx.md +1 -1
  117. package/docs/Microsoft.Quantum.Intrinsic/Ry.md +1 -1
  118. package/docs/Microsoft.Quantum.Intrinsic/Ryy.md +1 -1
  119. package/docs/Microsoft.Quantum.Intrinsic/Rz.md +1 -1
  120. package/docs/Microsoft.Quantum.Intrinsic/Rzz.md +1 -1
  121. package/docs/Microsoft.Quantum.Intrinsic/S.md +1 -1
  122. package/docs/Microsoft.Quantum.Intrinsic/SWAP.md +1 -1
  123. package/docs/Microsoft.Quantum.Intrinsic/T.md +1 -1
  124. package/docs/Microsoft.Quantum.Intrinsic/X.md +1 -1
  125. package/docs/Microsoft.Quantum.Intrinsic/Y.md +1 -1
  126. package/docs/Microsoft.Quantum.Intrinsic/Z.md +1 -1
  127. package/docs/Microsoft.Quantum.Logical/Xor.md +1 -1
  128. package/docs/Microsoft.Quantum.Math/AbsComplex.md +1 -1
  129. package/docs/Microsoft.Quantum.Math/AbsComplexPolar.md +1 -1
  130. package/docs/Microsoft.Quantum.Math/AbsD.md +1 -1
  131. package/docs/Microsoft.Quantum.Math/AbsI.md +1 -1
  132. package/docs/Microsoft.Quantum.Math/AbsL.md +1 -1
  133. package/docs/Microsoft.Quantum.Math/AbsSquaredComplex.md +1 -1
  134. package/docs/Microsoft.Quantum.Math/AbsSquaredComplexPolar.md +1 -1
  135. package/docs/Microsoft.Quantum.Math/ApproximateFactorial.md +1 -1
  136. package/docs/Microsoft.Quantum.Math/ArcCos.md +1 -1
  137. package/docs/Microsoft.Quantum.Math/ArcCosh.md +1 -1
  138. package/docs/Microsoft.Quantum.Math/ArcSin.md +1 -1
  139. package/docs/Microsoft.Quantum.Math/ArcSinh.md +1 -1
  140. package/docs/Microsoft.Quantum.Math/ArcTan.md +1 -1
  141. package/docs/Microsoft.Quantum.Math/ArcTan2.md +1 -1
  142. package/docs/Microsoft.Quantum.Math/ArcTanh.md +1 -1
  143. package/docs/Microsoft.Quantum.Math/ArgComplex.md +1 -1
  144. package/docs/Microsoft.Quantum.Math/ArgComplexPolar.md +1 -1
  145. package/docs/Microsoft.Quantum.Math/Binom.md +1 -1
  146. package/docs/Microsoft.Quantum.Math/BitSizeI.md +1 -1
  147. package/docs/Microsoft.Quantum.Math/BitSizeL.md +1 -1
  148. package/docs/Microsoft.Quantum.Math/Ceiling.md +1 -1
  149. package/docs/Microsoft.Quantum.Math/Complex.md +1 -1
  150. package/docs/Microsoft.Quantum.Math/ComplexPolar.md +1 -1
  151. package/docs/Microsoft.Quantum.Math/ContinuedFractionConvergentI.md +1 -1
  152. package/docs/Microsoft.Quantum.Math/ContinuedFractionConvergentL.md +1 -1
  153. package/docs/Microsoft.Quantum.Math/Cos.md +1 -1
  154. package/docs/Microsoft.Quantum.Math/Cosh.md +1 -1
  155. package/docs/Microsoft.Quantum.Math/DivRemI.md +1 -1
  156. package/docs/Microsoft.Quantum.Math/DivRemL.md +1 -1
  157. package/docs/Microsoft.Quantum.Math/DividedByC.md +1 -1
  158. package/docs/Microsoft.Quantum.Math/DividedByCP.md +1 -1
  159. package/docs/Microsoft.Quantum.Math/E.md +1 -1
  160. package/docs/Microsoft.Quantum.Math/ExpModI.md +1 -1
  161. package/docs/Microsoft.Quantum.Math/ExpModL.md +1 -1
  162. package/docs/Microsoft.Quantum.Math/ExtendedGreatestCommonDivisorI.md +1 -1
  163. package/docs/Microsoft.Quantum.Math/ExtendedGreatestCommonDivisorL.md +1 -1
  164. package/docs/Microsoft.Quantum.Math/FactorialI.md +1 -1
  165. package/docs/Microsoft.Quantum.Math/FactorialL.md +1 -1
  166. package/docs/Microsoft.Quantum.Math/Floor.md +1 -1
  167. package/docs/Microsoft.Quantum.Math/GreatestCommonDivisorI.md +1 -1
  168. package/docs/Microsoft.Quantum.Math/GreatestCommonDivisorL.md +1 -1
  169. package/docs/Microsoft.Quantum.Math/HammingWeightI.md +1 -1
  170. package/docs/Microsoft.Quantum.Math/InverseModI.md +1 -1
  171. package/docs/Microsoft.Quantum.Math/InverseModL.md +1 -1
  172. package/docs/Microsoft.Quantum.Math/IsCoprimeI.md +1 -1
  173. package/docs/Microsoft.Quantum.Math/IsCoprimeL.md +1 -1
  174. package/docs/Microsoft.Quantum.Math/IsInfinite.md +1 -1
  175. package/docs/Microsoft.Quantum.Math/IsNaN.md +1 -1
  176. package/docs/Microsoft.Quantum.Math/LargestFixedPoint.md +1 -1
  177. package/docs/Microsoft.Quantum.Math/Lg.md +1 -1
  178. package/docs/Microsoft.Quantum.Math/Log.md +1 -1
  179. package/docs/Microsoft.Quantum.Math/Log10.md +1 -1
  180. package/docs/Microsoft.Quantum.Math/LogFactorialD.md +1 -1
  181. package/docs/Microsoft.Quantum.Math/LogGammaD.md +1 -1
  182. package/docs/Microsoft.Quantum.Math/LogOf2.md +1 -1
  183. package/docs/Microsoft.Quantum.Math/Max.md +1 -1
  184. package/docs/Microsoft.Quantum.Math/MaxD.md +1 -1
  185. package/docs/Microsoft.Quantum.Math/MaxI.md +1 -1
  186. package/docs/Microsoft.Quantum.Math/MaxL.md +1 -1
  187. package/docs/Microsoft.Quantum.Math/Min.md +1 -1
  188. package/docs/Microsoft.Quantum.Math/MinD.md +1 -1
  189. package/docs/Microsoft.Quantum.Math/MinI.md +1 -1
  190. package/docs/Microsoft.Quantum.Math/MinL.md +1 -1
  191. package/docs/Microsoft.Quantum.Math/MinusC.md +1 -1
  192. package/docs/Microsoft.Quantum.Math/MinusCP.md +1 -1
  193. package/docs/Microsoft.Quantum.Math/ModulusI.md +1 -1
  194. package/docs/Microsoft.Quantum.Math/ModulusL.md +1 -1
  195. package/docs/Microsoft.Quantum.Math/NegationC.md +1 -1
  196. package/docs/Microsoft.Quantum.Math/NegationCP.md +1 -1
  197. package/docs/Microsoft.Quantum.Math/PI.md +1 -1
  198. package/docs/Microsoft.Quantum.Math/PNorm.md +1 -1
  199. package/docs/Microsoft.Quantum.Math/PNormalized.md +1 -1
  200. package/docs/Microsoft.Quantum.Math/PlusC.md +1 -1
  201. package/docs/Microsoft.Quantum.Math/PlusCP.md +1 -1
  202. package/docs/Microsoft.Quantum.Math/PowC.md +1 -1
  203. package/docs/Microsoft.Quantum.Math/PowCP.md +1 -1
  204. package/docs/Microsoft.Quantum.Math/RealMod.md +1 -1
  205. package/docs/Microsoft.Quantum.Math/Round.md +1 -1
  206. package/docs/Microsoft.Quantum.Math/SignD.md +1 -1
  207. package/docs/Microsoft.Quantum.Math/SignI.md +1 -1
  208. package/docs/Microsoft.Quantum.Math/SignL.md +1 -1
  209. package/docs/Microsoft.Quantum.Math/Sin.md +1 -1
  210. package/docs/Microsoft.Quantum.Math/Sinh.md +1 -1
  211. package/docs/Microsoft.Quantum.Math/SmallestFixedPoint.md +1 -1
  212. package/docs/Microsoft.Quantum.Math/Sqrt.md +1 -1
  213. package/docs/Microsoft.Quantum.Math/SquaredNorm.md +1 -1
  214. package/docs/Microsoft.Quantum.Math/Tan.md +1 -1
  215. package/docs/Microsoft.Quantum.Math/Tanh.md +1 -1
  216. package/docs/Microsoft.Quantum.Math/TimesC.md +1 -1
  217. package/docs/Microsoft.Quantum.Math/TimesCP.md +1 -1
  218. package/docs/Microsoft.Quantum.Math/TrailingZeroCountI.md +1 -1
  219. package/docs/Microsoft.Quantum.Math/TrailingZeroCountL.md +1 -1
  220. package/docs/Microsoft.Quantum.Math/Truncate.md +1 -1
  221. package/docs/Microsoft.Quantum.Measurement/MResetEachZ.md +1 -1
  222. package/docs/Microsoft.Quantum.Measurement/MResetX.md +1 -1
  223. package/docs/Microsoft.Quantum.Measurement/MResetY.md +1 -1
  224. package/docs/Microsoft.Quantum.Measurement/MResetZ.md +1 -1
  225. package/docs/Microsoft.Quantum.Measurement/MeasureAllZ.md +1 -1
  226. package/docs/Microsoft.Quantum.Measurement/MeasureEachZ.md +1 -1
  227. package/docs/Microsoft.Quantum.Measurement/MeasureInteger.md +1 -1
  228. package/docs/Microsoft.Quantum.ResourceEstimation/AccountForEstimates.md +1 -1
  229. package/docs/Microsoft.Quantum.ResourceEstimation/AuxQubitCount.md +1 -1
  230. package/docs/Microsoft.Quantum.ResourceEstimation/BeginEstimateCaching.md +1 -1
  231. package/docs/Microsoft.Quantum.ResourceEstimation/BeginRepeatEstimates.md +1 -1
  232. package/docs/Microsoft.Quantum.ResourceEstimation/CczCount.md +1 -1
  233. package/docs/Microsoft.Quantum.ResourceEstimation/EndEstimateCaching.md +1 -1
  234. package/docs/Microsoft.Quantum.ResourceEstimation/EndRepeatEstimates.md +1 -1
  235. package/docs/Microsoft.Quantum.ResourceEstimation/MeasurementCount.md +1 -1
  236. package/docs/Microsoft.Quantum.ResourceEstimation/PSSPCLayout.md +1 -1
  237. package/docs/Microsoft.Quantum.ResourceEstimation/RepeatEstimates.md +1 -1
  238. package/docs/Microsoft.Quantum.ResourceEstimation/RotationCount.md +1 -1
  239. package/docs/Microsoft.Quantum.ResourceEstimation/RotationDepth.md +1 -1
  240. package/docs/Microsoft.Quantum.ResourceEstimation/SingleVariant.md +1 -1
  241. package/docs/Microsoft.Quantum.ResourceEstimation/TCount.md +1 -1
  242. package/docs/Microsoft.Quantum.Unstable.Arithmetic/AddLE.md +1 -1
  243. package/docs/Microsoft.Quantum.Unstable.Arithmetic/ApplyIfEqualL.md +1 -1
  244. package/docs/Microsoft.Quantum.Unstable.Arithmetic/ApplyIfEqualLE.md +1 -1
  245. package/docs/Microsoft.Quantum.Unstable.Arithmetic/ApplyIfGreaterL.md +1 -1
  246. package/docs/Microsoft.Quantum.Unstable.Arithmetic/ApplyIfGreaterLE.md +1 -1
  247. package/docs/Microsoft.Quantum.Unstable.Arithmetic/ApplyIfGreaterOrEqualL.md +1 -1
  248. package/docs/Microsoft.Quantum.Unstable.Arithmetic/ApplyIfGreaterOrEqualLE.md +1 -1
  249. package/docs/Microsoft.Quantum.Unstable.Arithmetic/ApplyIfLessL.md +1 -1
  250. package/docs/Microsoft.Quantum.Unstable.Arithmetic/ApplyIfLessLE.md +1 -1
  251. package/docs/Microsoft.Quantum.Unstable.Arithmetic/ApplyIfLessOrEqualL.md +1 -1
  252. package/docs/Microsoft.Quantum.Unstable.Arithmetic/ApplyIfLessOrEqualLE.md +1 -1
  253. package/docs/Microsoft.Quantum.Unstable.Arithmetic/FourierTDIncByLE.md +1 -1
  254. package/docs/Microsoft.Quantum.Unstable.Arithmetic/IncByI.md +1 -1
  255. package/docs/Microsoft.Quantum.Unstable.Arithmetic/IncByIUsingIncByLE.md +1 -1
  256. package/docs/Microsoft.Quantum.Unstable.Arithmetic/IncByL.md +1 -1
  257. package/docs/Microsoft.Quantum.Unstable.Arithmetic/IncByLE.md +1 -1
  258. package/docs/Microsoft.Quantum.Unstable.Arithmetic/IncByLEUsingAddLE.md +1 -1
  259. package/docs/Microsoft.Quantum.Unstable.Arithmetic/IncByLUsingIncByLE.md +1 -1
  260. package/docs/Microsoft.Quantum.Unstable.Arithmetic/LookAheadDKRSAddLE.md +1 -1
  261. package/docs/Microsoft.Quantum.Unstable.Arithmetic/MAJ.md +1 -1
  262. package/docs/Microsoft.Quantum.Unstable.Arithmetic/ReflectAboutInteger.md +1 -1
  263. package/docs/Microsoft.Quantum.Unstable.Arithmetic/RippleCarryCGAddLE.md +1 -1
  264. package/docs/Microsoft.Quantum.Unstable.Arithmetic/RippleCarryCGIncByLE.md +1 -1
  265. package/docs/Microsoft.Quantum.Unstable.Arithmetic/RippleCarryTTKIncByLE.md +1 -1
  266. package/docs/Microsoft.Quantum.Unstable.StatePreparation/ApproximatelyPreparePureStateCP.md +1 -1
  267. package/docs/Microsoft.Quantum.Unstable.StatePreparation/PreparePureStateD.md +1 -1
  268. package/docs/Microsoft.Quantum.Unstable.TableLookup/Select.md +1 -1
  269. package/lib/node/qsc_wasm.cjs +133 -152
  270. package/lib/node/qsc_wasm.d.cts +62 -36
  271. package/lib/node/qsc_wasm_bg.wasm +0 -0
  272. package/lib/web/qsc_wasm.d.ts +71 -45
  273. package/lib/web/qsc_wasm.js +126 -150
  274. package/lib/web/qsc_wasm_bg.wasm +0 -0
  275. package/package.json +1 -1
  276. package/ux/estimatesOverview.tsx +2 -0
  277. package/ux/estimatesPanel.tsx +2 -0
  278. package/ux/qsharp-ux.css +30 -5
  279. package/ux/saveImage.tsx +107 -0
  280. package/ux/saveImageUtil.tsx +72 -0
  281. package/ux/scatterChart.tsx +31 -0
package/dist/browser.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as wasm from "../lib/web/qsc_wasm.js";
2
- import { TargetProfile } from "../lib/web/qsc_wasm.js";
2
+ import { IProjectHost, TargetProfile } from "../lib/web/qsc_wasm.js";
3
3
  import { ICompiler, ICompilerWorker } from "./compiler/compiler.js";
4
4
  import { IDebugService, IDebugServiceWorker } from "./debug-service/debug-service.js";
5
5
  import { ILanguageService, ILanguageServiceWorker, qsharpLibraryUriScheme } from "./language-service/language-service.js";
@@ -8,18 +8,14 @@ export { qsharpLibraryUriScheme };
8
8
  export declare function loadWasmModule(uriOrBuffer: string | ArrayBuffer): Promise<void>;
9
9
  export declare function getLibrarySourceContent(path: string): Promise<string | undefined>;
10
10
  export declare function getDebugService(): Promise<IDebugService>;
11
- export declare function getProjectLoader(readFile: (path: string) => Promise<string | null>, loadDirectory: (path: string) => Promise<[string, number][]>, getManifest: (path: string) => Promise<{
12
- manifestDirectory: string;
13
- } | null>): Promise<wasm.ProjectLoader>;
11
+ export declare function getProjectLoader(host: IProjectHost): Promise<wasm.ProjectLoader>;
14
12
  export declare function getDebugServiceWorker(worker: string | Worker): IDebugServiceWorker;
15
13
  export declare function getCompiler(): Promise<ICompiler>;
16
14
  export declare function getCompilerWorker(worker: string | Worker): ICompilerWorker;
17
- export declare function getLanguageService(readFile?: (uri: string) => Promise<string | null>, listDir?: (uri: string) => Promise<[string, number][]>, getManifest?: (uri: string) => Promise<{
18
- manifestDirectory: string;
19
- } | null>): Promise<ILanguageService>;
15
+ export declare function getLanguageService(host?: IProjectHost): Promise<ILanguageService>;
20
16
  export declare function getLanguageServiceWorker(worker: string | Worker): ILanguageServiceWorker;
21
17
  export { StepResultId } from "../lib/web/qsc_wasm.js";
22
- export type { IBreakpointSpan, ICodeAction, ICodeLens, IDocFile, ILocation, IOperationInfo, IPosition, IQSharpError, IRange, IStackFrame, IWorkspaceEdit, IStructStepResult, VSDiagnostic, } from "../lib/web/qsc_wasm.js";
18
+ export type { IBreakpointSpan, ICodeAction, ICodeLens, IDocFile, ILocation, IOperationInfo, IPosition, IProjectConfig, IProjectHost, IQSharpError, IRange, IStackFrame, IStructStepResult, IWorkspaceEdit, ProjectLoader, VSDiagnostic, } from "../lib/web/qsc_wasm.js";
23
19
  export { type Dump, type ShotResult } from "./compiler/common.js";
24
20
  export { type CompilerState, type ProgramConfig } from "./compiler/compiler.js";
25
21
  export { QscEventTarget } from "./compiler/events.js";
package/dist/browser.js CHANGED
@@ -71,9 +71,9 @@ export async function getDebugService() {
71
71
  await instantiateWasm();
72
72
  return new QSharpDebugService(wasm);
73
73
  }
74
- export async function getProjectLoader(readFile, loadDirectory, getManifest) {
74
+ export async function getProjectLoader(host) {
75
75
  await instantiateWasm();
76
- return new wasm.ProjectLoader(readFile, loadDirectory, getManifest);
76
+ return new wasm.ProjectLoader(host);
77
77
  }
78
78
  // Create the debugger inside a WebWorker and proxy requests.
79
79
  // If the Worker was already created via other means and is ready to receive
@@ -95,9 +95,9 @@ export function getCompilerWorker(worker) {
95
95
  throw "Wasm module must be loaded first";
96
96
  return createProxy(worker, wasmModule, compilerProtocol);
97
97
  }
98
- export async function getLanguageService(readFile, listDir, getManifest) {
98
+ export async function getLanguageService(host) {
99
99
  await instantiateWasm();
100
- return new QSharpLanguageService(wasm, readFile, listDir, getManifest);
100
+ return new QSharpLanguageService(wasm, host);
101
101
  }
102
102
  // Create the compiler inside a WebWorker and proxy requests.
103
103
  // If the Worker was already created via other means and is ready to receive
@@ -1,5 +1,5 @@
1
1
  import { type Circuit as CircuitData } from "@microsoft/quantum-viz.js/lib/circuit.js";
2
- import { IDocFile, IOperationInfo, TargetProfile, type VSDiagnostic } from "../../lib/web/qsc_wasm.js";
2
+ import { IDocFile, IOperationInfo, IProgramConfig as wasmIProgramConfig, TargetProfile, type VSDiagnostic } from "../../lib/web/qsc_wasm.js";
3
3
  import { IServiceProxy, ServiceProtocol, ServiceState } from "../workers/common.js";
4
4
  import { IQscEventTarget, QscEventData } from "./events.js";
5
5
  type Wasm = typeof import("../../lib/web/qsc_wasm.js");
@@ -7,35 +7,17 @@ export interface ICompiler {
7
7
  checkCode(code: string): Promise<VSDiagnostic[]>;
8
8
  getAst(code: string, languageFeatures?: string[], profile?: TargetProfile): Promise<string>;
9
9
  getHir(code: string, languageFeatures?: string[], profile?: TargetProfile): Promise<string>;
10
- /** @deprecated -- switch to using `ProgramConfig`-based overload. Instead of passing
11
- * sources and language features separately, pass an object with named properties. This change was made
12
- * for the sake of extensibility and future-compatibility. Note that only the new API
13
- * supports passing language features. If you need to pass language features, you must use
14
- * the new API.
15
- **/
16
- run(sources: [string, string][], expr: string, shots: number, eventHandler: IQscEventTarget): Promise<void>;
17
- run(config: ProgramConfig, expr: string, shots: number, eventHandler: IQscEventTarget): Promise<void>;
18
- /** @deprecated -- switch to using `ProgramConfig`-based overload. Instead of passing
19
- * sources and language features separately, pass an object with named properties. This change was made
20
- * for the sake of extensibility and future-compatibility. Note that only the new API
21
- * supports passing language features. If you need to pass language features, you must use
22
- * the new API.
23
- **/
24
- getQir(sources: [string, string][], languageFeatures?: string[]): Promise<string>;
25
- getQir(config: ProgramConfig): Promise<string>;
26
- /** @deprecated -- switch to using `ProgramConfig`-based overload. Instead of passing
27
- * sources and language features separately, pass an object with named properties. This change was made
28
- * for the sake of extensibility and future-compatibility. Note that only the new API
29
- * supports passing language features. If you need to pass language features, you must use
30
- * the new API.
31
- **/
32
- getEstimates(sources: [string, string][], params: string, languageFeatures?: string[]): Promise<string>;
33
- getEstimates(config: ProgramConfig, params: string): Promise<string>;
34
- getCircuit(config: ProgramConfig, target: TargetProfile, simulate: boolean, operation?: IOperationInfo): Promise<CircuitData>;
35
- getDocumentation(additionalSources?: [string, string][], targetProfile?: string, languageFeatures?: string[]): Promise<IDocFile[]>;
10
+ run(program: ProgramConfig, expr: string, shots: number, eventHandler: IQscEventTarget): Promise<void>;
11
+ getQir(program: ProgramConfig): Promise<string>;
12
+ getEstimates(program: ProgramConfig, params: string): Promise<string>;
13
+ getCircuit(program: ProgramConfig, simulate: boolean, operation?: IOperationInfo): Promise<CircuitData>;
14
+ getDocumentation(additionalProgram?: ProgramConfig): Promise<IDocFile[]>;
36
15
  checkExerciseSolution(userCode: string, exerciseSources: string[], eventHandler: IQscEventTarget): Promise<boolean>;
37
16
  }
38
- /** Type definition for the configuration of a program. */
17
+ /**
18
+ * Type definition for the configuration of a program.
19
+ * If adding new properties, make them optional to maintain backward compatibility.
20
+ */
39
21
  export type ProgramConfig = {
40
22
  /** An array of source objects, each containing a name and contents. */
41
23
  sources: [string, string][];
@@ -50,19 +32,20 @@ export declare class Compiler implements ICompiler {
50
32
  private wasm;
51
33
  constructor(wasm: Wasm);
52
34
  checkCode(code: string): Promise<VSDiagnostic[]>;
53
- getQir(sourcesOrConfig: [string, string][] | ProgramConfig, languageFeatures?: string[]): Promise<string>;
54
- newGetQir({ sources, languageFeatures, profile, }: ProgramConfig): Promise<string>;
55
- deprecatedGetQir(sources: [string, string][], languageFeatures: string[]): Promise<string>;
56
- getEstimates(sourcesOrConfig: [string, string][] | ProgramConfig, params: string, languageFeatures?: string[]): Promise<string>;
57
- newGetEstimates({ sources, languageFeatures, profile }: ProgramConfig, params: string): Promise<string>;
58
- deprecatedGetEstimates(sources: [string, string][], params: string, languageFeatures: string[]): Promise<string>;
59
35
  getAst(code: string, languageFeatures?: string[], profile?: TargetProfile): Promise<string>;
60
36
  getHir(code: string, languageFeatures: string[], profile: TargetProfile): Promise<string>;
61
- run(sourcesOrConfig: [string, string][] | ProgramConfig, expr: string, shots: number, eventHandler: IQscEventTarget): Promise<void>;
62
- getCircuit(config: ProgramConfig, target: TargetProfile, simulate: boolean, operation?: IOperationInfo): Promise<CircuitData>;
63
- getDocumentation(additionalSources?: [string, string][], targetProfile?: string, languageFeatures?: string[]): Promise<IDocFile[]>;
37
+ run(program: ProgramConfig, expr: string, shots: number, eventHandler: IQscEventTarget): Promise<void>;
38
+ getQir(program: ProgramConfig): Promise<string>;
39
+ getEstimates(program: ProgramConfig, params: string): Promise<string>;
40
+ getCircuit(program: ProgramConfig, simulate: boolean, operation?: IOperationInfo): Promise<CircuitData>;
41
+ getDocumentation(additionalProgram?: ProgramConfig): Promise<IDocFile[]>;
64
42
  checkExerciseSolution(userCode: string, exerciseSources: string[], eventHandler: IQscEventTarget): Promise<boolean>;
65
43
  }
44
+ /**
45
+ * Fills in the defaults, to convert from the backwards-compatible ProgramConfig,
46
+ * to the IProgramConfig type that the wasm layer expects
47
+ */
48
+ export declare function toWasmProgramConfig(program: ProgramConfig, defaultProfile: TargetProfile): Required<wasmIProgramConfig>;
66
49
  export declare function onCompilerEvent(msg: string, eventTarget: IQscEventTarget): void;
67
50
  /** The protocol definition to allow running the compiler in a worker. */
68
51
  export declare const compilerProtocol: ServiceProtocol<ICompiler, QscEventData>;
@@ -16,7 +16,12 @@ export class Compiler {
16
16
  const languageService = new this.wasm.LanguageService();
17
17
  const work = languageService.start_background_work((uri, version, errors) => {
18
18
  diags = errors;
19
- }, () => Promise.resolve(null), () => Promise.resolve([]), () => Promise.resolve(null));
19
+ }, {
20
+ readFile: async () => null,
21
+ listDirectory: async () => [],
22
+ resolvePath: async () => null,
23
+ findManifestDirectory: async () => null,
24
+ });
20
25
  languageService.update_document("code", 1, code);
21
26
  // Yield to let the language service background worker handle the update
22
27
  await Promise.resolve();
@@ -25,75 +30,50 @@ export class Compiler {
25
30
  languageService.free();
26
31
  return diags;
27
32
  }
28
- async getQir(sourcesOrConfig, languageFeatures) {
29
- if (Array.isArray(sourcesOrConfig)) {
30
- return this.deprecatedGetQir(sourcesOrConfig, languageFeatures || []);
31
- }
32
- else {
33
- const config = sourcesOrConfig;
34
- return this.newGetQir(config);
35
- }
36
- }
37
- async newGetQir({ sources, languageFeatures = [], profile = "base", }) {
38
- return this.wasm.get_qir(sources, languageFeatures, profile);
39
- }
40
- async deprecatedGetQir(sources, languageFeatures) {
41
- return this.wasm.get_qir(sources, languageFeatures, "base");
42
- }
43
- async getEstimates(sourcesOrConfig, params, languageFeatures = []) {
44
- if (Array.isArray(sourcesOrConfig)) {
45
- return this.deprecatedGetEstimates(sourcesOrConfig, params, languageFeatures);
46
- }
47
- else {
48
- return this.newGetEstimates(sourcesOrConfig, params);
49
- }
50
- }
51
- async newGetEstimates({ sources, languageFeatures, profile = "unrestricted" }, params) {
52
- return this.wasm.get_estimates(sources, params, languageFeatures || [], profile);
53
- }
54
- async deprecatedGetEstimates(sources, params, languageFeatures) {
55
- return this.wasm.get_estimates(sources, params, languageFeatures, "unrestricted");
56
- }
57
33
  async getAst(code, languageFeatures, profile) {
58
34
  return this.wasm.get_ast(code, languageFeatures ?? [], profile ?? "adaptive_ri");
59
35
  }
60
36
  async getHir(code, languageFeatures, profile) {
61
37
  return this.wasm.get_hir(code, languageFeatures ?? [], profile ?? "adaptive_ri");
62
38
  }
63
- async run(sourcesOrConfig, expr, shots, eventHandler) {
64
- let sources;
65
- let profile = "unrestricted";
66
- let languageFeatures = [];
67
- if (Array.isArray(sourcesOrConfig)) {
68
- // this is the deprecated API
69
- sources = sourcesOrConfig;
70
- }
71
- else {
72
- // this is the new API
73
- sources = sourcesOrConfig.sources;
74
- languageFeatures = sourcesOrConfig.languageFeatures || [];
75
- profile = sourcesOrConfig.profile || "unrestricted";
76
- }
39
+ async run(program, expr, shots, eventHandler) {
77
40
  // All results are communicated as events, but if there is a compiler error (e.g. an invalid
78
41
  // entry expression or similar), it may throw on run. The caller should expect this promise
79
42
  // may reject without all shots running or events firing.
80
- this.wasm.run(sources, expr, (msg) => onCompilerEvent(msg, eventHandler), shots, languageFeatures, profile);
43
+ this.wasm.run(toWasmProgramConfig(program, "unrestricted"), expr, (msg) => onCompilerEvent(msg, eventHandler), shots);
44
+ }
45
+ async getQir(program) {
46
+ return this.wasm.get_qir(toWasmProgramConfig(program, "base"));
81
47
  }
82
- async getCircuit(config, target, simulate, operation) {
83
- return this.wasm.get_circuit(config.sources, target, config.languageFeatures || [], simulate, operation);
48
+ async getEstimates(program, params) {
49
+ return this.wasm.get_estimates(toWasmProgramConfig(program, "unrestricted"), params);
50
+ }
51
+ async getCircuit(program, simulate, operation) {
52
+ return this.wasm.get_circuit(toWasmProgramConfig(program, "unrestricted"), simulate, operation);
84
53
  }
85
54
  // Returns all autogenerated documentation files for the standard library
86
55
  // and loaded project (if requested). This include file names and metadata,
87
56
  // including specially formatted table of content file.
88
- async getDocumentation(additionalSources, targetProfile, languageFeatures) {
89
- // Get documentation from wasm layer
90
- return this.wasm.generate_docs(additionalSources, targetProfile, languageFeatures);
57
+ async getDocumentation(additionalProgram) {
58
+ return this.wasm.generate_docs(additionalProgram &&
59
+ toWasmProgramConfig(additionalProgram, "unrestricted"));
91
60
  }
92
61
  async checkExerciseSolution(userCode, exerciseSources, eventHandler) {
93
62
  const success = this.wasm.check_exercise_solution(userCode, exerciseSources, (msg) => onCompilerEvent(msg, eventHandler));
94
63
  return success;
95
64
  }
96
65
  }
66
+ /**
67
+ * Fills in the defaults, to convert from the backwards-compatible ProgramConfig,
68
+ * to the IProgramConfig type that the wasm layer expects
69
+ */
70
+ export function toWasmProgramConfig(program, defaultProfile) {
71
+ return {
72
+ sources: program.sources,
73
+ languageFeatures: program.languageFeatures || [],
74
+ profile: program.profile || defaultProfile,
75
+ };
76
+ }
97
77
  export function onCompilerEvent(msg, eventTarget) {
98
78
  const qscMsg = eventStringToMsg(msg);
99
79
  if (!qscMsg) {
@@ -1,11 +1,11 @@
1
1
  import { type Circuit as CircuitData } from "@microsoft/quantum-viz.js/lib/circuit.js";
2
2
  import type { IBreakpointSpan, IQuantumState, IStackFrame, IStructStepResult, IVariable } from "../../lib/web/qsc_wasm.js";
3
- import { TargetProfile } from "../browser.js";
3
+ import { ProgramConfig } from "../browser.js";
4
4
  import { IQscEventTarget, QscEventData } from "../compiler/events.js";
5
5
  import { IServiceProxy, ServiceProtocol } from "../workers/common.js";
6
6
  type QscWasm = typeof import("../../lib/web/qsc_wasm.js");
7
7
  export interface IDebugService {
8
- loadSource(sources: [string, string][], target: TargetProfile, entry: string | undefined, language_features: string[]): Promise<string>;
8
+ loadProgram(program: ProgramConfig, entry: string | undefined): Promise<string>;
9
9
  getBreakpoints(path: string): Promise<IBreakpointSpan[]>;
10
10
  getLocalVariables(): Promise<Array<IVariable>>;
11
11
  captureQuantumState(): Promise<Array<IQuantumState>>;
@@ -22,7 +22,7 @@ export declare class QSharpDebugService implements IDebugService {
22
22
  private wasm;
23
23
  private debugService;
24
24
  constructor(wasm: QscWasm);
25
- loadSource(sources: [string, string][], target: TargetProfile, entry: string | undefined, language_features: string[]): Promise<string>;
25
+ loadProgram(program: ProgramConfig, entry: string | undefined): Promise<string>;
26
26
  getBreakpoints(path: string): Promise<IBreakpointSpan[]>;
27
27
  getLocalVariables(): Promise<Array<IVariable>>;
28
28
  captureQuantumState(): Promise<Array<IQuantumState>>;
@@ -3,14 +3,15 @@
3
3
  import { eventStringToMsg } from "../compiler/common.js";
4
4
  import { makeEvent, } from "../compiler/events.js";
5
5
  import { log } from "../log.js";
6
+ import { toWasmProgramConfig } from "../compiler/compiler.js";
6
7
  export class QSharpDebugService {
7
8
  constructor(wasm) {
8
9
  log.info("Constructing a QSharpDebugService instance");
9
10
  this.wasm = wasm;
10
11
  this.debugService = new wasm.DebugService();
11
12
  }
12
- async loadSource(sources, target, entry, language_features) {
13
- return this.debugService.load_source(sources, target, entry, language_features);
13
+ async loadProgram(program, entry) {
14
+ return this.debugService.load_program(toWasmProgramConfig(program, "unrestricted"), entry);
14
15
  }
15
16
  async getBreakpoints(path) {
16
17
  return this.debugService.get_breakpoints(path).spans;
@@ -85,7 +86,7 @@ export function onCompilerEvent(msg, eventTarget) {
85
86
  export const debugServiceProtocol = {
86
87
  class: QSharpDebugService,
87
88
  methods: {
88
- loadSource: "request",
89
+ loadProgram: "request",
89
90
  getBreakpoints: "request",
90
91
  getLocalVariables: "request",
91
92
  captureQuantumState: "request",
@@ -3655,7 +3655,12 @@ export default {
3655
3655
  "type": "lesson",
3656
3656
  "id": "distinguishing_states__orthogonal_states",
3657
3657
  "title": "Distinguishing Orthogonal States",
3658
- "items": []
3658
+ "items": [
3659
+ {
3660
+ "type": "text-content",
3661
+ "content": "<p>In this lesson, you will practice distinguishing sets of states that are pairwise orthogonal.\nIn this scenario, the states can be distinguished perfectly, with 100% accuracy.</p>\n"
3662
+ }
3663
+ ]
3659
3664
  },
3660
3665
  {
3661
3666
  "type": "exercise",
@@ -3967,7 +3972,7 @@ export default {
3967
3972
  "title": "Distinguish Four Bell States",
3968
3973
  "description": {
3969
3974
  "type": "text-content",
3970
- "content": "<p><strong>Input:</strong> Two qubits (stored in an array of length 2) which are guaranteed to be in one of the four Bell states.</p>\n<p>Output:</p>\n<ul>\n<li>0 if they were in the state $\\ket{\\Phi^{+}} = \\frac{1}{\\sqrt{2}} \\big(\\ket{00} + \\ket{11}\\big)$,</li>\n<li>1 if they were in the state $\\ket{\\Phi^{-}} = \\frac{1}{\\sqrt{2}} \\big(\\ket{00} - \\ket{11}\\big)$,</li>\n<li>2 if they were in the state $\\ket{\\Psi^{+}} = \\frac{1}{\\sqrt{2}} \\big(\\ket{01} + \\ket{10}\\big)$,</li>\n<li>3 if they were in the state $\\ket{\\Psi^{-}} = \\frac{1}{\\sqrt{2}} \\big(\\ket{01} - \\ket{10}\\big)$.</li>\n</ul>\n<p>The state of the qubits at the end of the operation does not matter.</p>\n"
3975
+ "content": "<p><strong>Input:</strong> Two qubits (stored in an array of length 2) which are guaranteed to be in one of the four Bell states.</p>\n<p><strong>Output:</strong></p>\n<ul>\n<li>0 if they were in the state $\\ket{\\Phi^{+}} = \\frac{1}{\\sqrt{2}} \\big(\\ket{00} + \\ket{11}\\big)$,</li>\n<li>1 if they were in the state $\\ket{\\Phi^{-}} = \\frac{1}{\\sqrt{2}} \\big(\\ket{00} - \\ket{11}\\big)$,</li>\n<li>2 if they were in the state $\\ket{\\Psi^{+}} = \\frac{1}{\\sqrt{2}} \\big(\\ket{01} + \\ket{10}\\big)$,</li>\n<li>3 if they were in the state $\\ket{\\Psi^{-}} = \\frac{1}{\\sqrt{2}} \\big(\\ket{01} - \\ket{10}\\big)$.</li>\n</ul>\n<p>The state of the qubits at the end of the operation does not matter.</p>\n"
3971
3976
  },
3972
3977
  "sourceIds": [
3973
3978
  "distinguishing_states__four_bell_states__Verification.qs",
@@ -4079,8 +4084,13 @@ export default {
4079
4084
  {
4080
4085
  "type": "lesson",
4081
4086
  "id": "distinguishing_states__nonorthogonal_states",
4082
- "title": "Distinguishing Non-orthogonal States",
4083
- "items": []
4087
+ "title": "Distinguishing Non-Orthogonal States",
4088
+ "items": [
4089
+ {
4090
+ "type": "text-content",
4091
+ "content": "<p>This lesson offers you several variants of the task of distinguishing sets of states that are not orthogonal.</p>\n"
4092
+ }
4093
+ ]
4084
4094
  },
4085
4095
  {
4086
4096
  "type": "exercise",
@@ -4173,7 +4183,7 @@ export default {
4173
4183
  "items": [
4174
4184
  {
4175
4185
  "type": "text-content",
4176
- "content": "<p>Congratulations! In this kata you learned to use measurements and basic quantum computing gates to distinguish quantum states. Here are a few key concepts to keep in mind:</p>\n<ul>\n<li>TODO</li>\n</ul>\n"
4186
+ "content": "<p>Congratulations! In this kata you learned to use measurements and basic quantum computing gates to distinguish quantum states.</p>\n"
4177
4187
  }
4178
4188
  ]
4179
4189
  }
@@ -4199,7 +4209,12 @@ export default {
4199
4209
  "type": "lesson",
4200
4210
  "id": "distinguishing_unitaries__single_qubit",
4201
4211
  "title": "Distinguishing Single-Qubit Gates",
4202
- "items": []
4212
+ "items": [
4213
+ {
4214
+ "type": "text-content",
4215
+ "content": "<p>To start with, let's look at some problems involving distinguishing single-qubit gates.</p>\n"
4216
+ }
4217
+ ]
4203
4218
  },
4204
4219
  {
4205
4220
  "type": "exercise",
@@ -4495,7 +4510,12 @@ export default {
4495
4510
  "type": "lesson",
4496
4511
  "id": "distinguishing_unitaries__multi_qubit",
4497
4512
  "title": "Distinguishing Multi-Qubit Gates",
4498
- "items": []
4513
+ "items": [
4514
+ {
4515
+ "type": "text-content",
4516
+ "content": "<p>In this lesson, the exercises focus on distinguishing multi-qubit gates.</p>\n"
4517
+ }
4518
+ ]
4499
4519
  },
4500
4520
  {
4501
4521
  "type": "exercise",
@@ -7708,7 +7728,7 @@ export default {
7708
7728
  },
7709
7729
  {
7710
7730
  "id": "key_distribution__random_array__Verification.qs",
7711
- "code": "namespace Kata.Verification {\n open Microsoft.Quantum.Arrays;\n open Microsoft.Quantum.Convert;\n\n @EntryPoint()\n operation CheckSolution() : Bool {\n // The test only checks that the operation returns an array of correct length\n // and that it's not always the same. It doesn't analyze the distribution of true and false elements.\n let N = 10;\n let randomArrays = ForEach(Kata.RandomArray, [N, N, N]);\n\n for array in randomArrays {\n if Length(array) != N {\n Message($\"Returned array should have length {N}, and it had length {Length(array)}.\");\n return false;\n }\n }\n\n let randomInts = Mapped(BoolArrayAsInt, randomArrays);\n if randomInts[0] == randomInts[1] or randomInts[1] == randomInts[2] or randomInts[0] == randomInts[2] {\n Message($\"Random generation should not return a fixed array.\");\n return false;\n }\n\n Message(\"Correct!\");\n true\n }\n}\n"
7731
+ "code": "namespace Kata.Verification {\n open Microsoft.Quantum.Arrays;\n open Microsoft.Quantum.Convert;\n\n @EntryPoint()\n operation CheckSolution() : Bool {\n // The test only checks that the operation returns an array of correct length\n // and that it's not always the same. It doesn't analyze the distribution of true and false elements.\n let N = 20;\n let randomArrays = ForEach(Kata.RandomArray, [N, size = 10]);\n\n for array in randomArrays {\n if Length(array) != N {\n Message($\"Returned array should have length {N}, and it had length {Length(array)}.\");\n return false;\n }\n }\n\n let randomInts = Mapped(BoolArrayAsInt, randomArrays);\n mutable allSame = true;\n for int in randomInts {\n if int != randomInts[0] {\n set allSame = false;\n }\n }\n if allSame {\n Message($\"Random generation should not return a fixed array.\");\n return false;\n }\n\n Message(\"Correct!\");\n true\n }\n}\n"
7712
7732
  },
7713
7733
  {
7714
7734
  "id": "key_distribution__prepare_qubits__Verification.qs",
@@ -3655,7 +3655,12 @@ export default {
3655
3655
  "type": "lesson",
3656
3656
  "id": "distinguishing_states__orthogonal_states",
3657
3657
  "title": "Distinguishing Orthogonal States",
3658
- "items": []
3658
+ "items": [
3659
+ {
3660
+ "type": "text-content",
3661
+ "content": "\nIn this lesson, you will practice distinguishing sets of states that are pairwise orthogonal.\nIn this scenario, the states can be distinguished perfectly, with 100% accuracy."
3662
+ }
3663
+ ]
3659
3664
  },
3660
3665
  {
3661
3666
  "type": "exercise",
@@ -3967,7 +3972,7 @@ export default {
3967
3972
  "title": "Distinguish Four Bell States",
3968
3973
  "description": {
3969
3974
  "type": "text-content",
3970
- "content": "**Input:** Two qubits (stored in an array of length 2) which are guaranteed to be in one of the four Bell states.\n\nOutput:\n* 0 if they were in the state $\\ket{\\Phi^{+}} = \\frac{1}{\\sqrt{2}} \\big(\\ket{00} + \\ket{11}\\big)$,\n* 1 if they were in the state $\\ket{\\Phi^{-}} = \\frac{1}{\\sqrt{2}} \\big(\\ket{00} - \\ket{11}\\big)$,\n* 2 if they were in the state $\\ket{\\Psi^{+}} = \\frac{1}{\\sqrt{2}} \\big(\\ket{01} + \\ket{10}\\big)$,\n* 3 if they were in the state $\\ket{\\Psi^{-}} = \\frac{1}{\\sqrt{2}} \\big(\\ket{01} - \\ket{10}\\big)$.\n \nThe state of the qubits at the end of the operation does not matter.\n"
3975
+ "content": "**Input:** Two qubits (stored in an array of length 2) which are guaranteed to be in one of the four Bell states.\n\n**Output:**\n* 0 if they were in the state $\\ket{\\Phi^{+}} = \\frac{1}{\\sqrt{2}} \\big(\\ket{00} + \\ket{11}\\big)$,\n* 1 if they were in the state $\\ket{\\Phi^{-}} = \\frac{1}{\\sqrt{2}} \\big(\\ket{00} - \\ket{11}\\big)$,\n* 2 if they were in the state $\\ket{\\Psi^{+}} = \\frac{1}{\\sqrt{2}} \\big(\\ket{01} + \\ket{10}\\big)$,\n* 3 if they were in the state $\\ket{\\Psi^{-}} = \\frac{1}{\\sqrt{2}} \\big(\\ket{01} - \\ket{10}\\big)$.\n \nThe state of the qubits at the end of the operation does not matter.\n"
3971
3976
  },
3972
3977
  "sourceIds": [
3973
3978
  "distinguishing_states__four_bell_states__Verification.qs",
@@ -4079,8 +4084,13 @@ export default {
4079
4084
  {
4080
4085
  "type": "lesson",
4081
4086
  "id": "distinguishing_states__nonorthogonal_states",
4082
- "title": "Distinguishing Non-orthogonal States",
4083
- "items": []
4087
+ "title": "Distinguishing Non-Orthogonal States",
4088
+ "items": [
4089
+ {
4090
+ "type": "text-content",
4091
+ "content": "\nThis lesson offers you several variants of the task of distinguishing sets of states that are not orthogonal."
4092
+ }
4093
+ ]
4084
4094
  },
4085
4095
  {
4086
4096
  "type": "exercise",
@@ -4173,7 +4183,7 @@ export default {
4173
4183
  "items": [
4174
4184
  {
4175
4185
  "type": "text-content",
4176
- "content": "\nCongratulations! In this kata you learned to use measurements and basic quantum computing gates to distinguish quantum states. Here are a few key concepts to keep in mind:\n\n- TODO"
4186
+ "content": "\nCongratulations! In this kata you learned to use measurements and basic quantum computing gates to distinguish quantum states."
4177
4187
  }
4178
4188
  ]
4179
4189
  }
@@ -4199,7 +4209,12 @@ export default {
4199
4209
  "type": "lesson",
4200
4210
  "id": "distinguishing_unitaries__single_qubit",
4201
4211
  "title": "Distinguishing Single-Qubit Gates",
4202
- "items": []
4212
+ "items": [
4213
+ {
4214
+ "type": "text-content",
4215
+ "content": "\nTo start with, let's look at some problems involving distinguishing single-qubit gates."
4216
+ }
4217
+ ]
4203
4218
  },
4204
4219
  {
4205
4220
  "type": "exercise",
@@ -4495,7 +4510,12 @@ export default {
4495
4510
  "type": "lesson",
4496
4511
  "id": "distinguishing_unitaries__multi_qubit",
4497
4512
  "title": "Distinguishing Multi-Qubit Gates",
4498
- "items": []
4513
+ "items": [
4514
+ {
4515
+ "type": "text-content",
4516
+ "content": "\nIn this lesson, the exercises focus on distinguishing multi-qubit gates."
4517
+ }
4518
+ ]
4499
4519
  },
4500
4520
  {
4501
4521
  "type": "exercise",
@@ -7708,7 +7728,7 @@ export default {
7708
7728
  },
7709
7729
  {
7710
7730
  "id": "key_distribution__random_array__Verification.qs",
7711
- "code": "namespace Kata.Verification {\n open Microsoft.Quantum.Arrays;\n open Microsoft.Quantum.Convert;\n\n @EntryPoint()\n operation CheckSolution() : Bool {\n // The test only checks that the operation returns an array of correct length\n // and that it's not always the same. It doesn't analyze the distribution of true and false elements.\n let N = 10;\n let randomArrays = ForEach(Kata.RandomArray, [N, N, N]);\n\n for array in randomArrays {\n if Length(array) != N {\n Message($\"Returned array should have length {N}, and it had length {Length(array)}.\");\n return false;\n }\n }\n\n let randomInts = Mapped(BoolArrayAsInt, randomArrays);\n if randomInts[0] == randomInts[1] or randomInts[1] == randomInts[2] or randomInts[0] == randomInts[2] {\n Message($\"Random generation should not return a fixed array.\");\n return false;\n }\n\n Message(\"Correct!\");\n true\n }\n}\n"
7731
+ "code": "namespace Kata.Verification {\n open Microsoft.Quantum.Arrays;\n open Microsoft.Quantum.Convert;\n\n @EntryPoint()\n operation CheckSolution() : Bool {\n // The test only checks that the operation returns an array of correct length\n // and that it's not always the same. It doesn't analyze the distribution of true and false elements.\n let N = 20;\n let randomArrays = ForEach(Kata.RandomArray, [N, size = 10]);\n\n for array in randomArrays {\n if Length(array) != N {\n Message($\"Returned array should have length {N}, and it had length {Length(array)}.\");\n return false;\n }\n }\n\n let randomInts = Mapped(BoolArrayAsInt, randomArrays);\n mutable allSame = true;\n for int in randomInts {\n if int != randomInts[0] {\n set allSame = false;\n }\n }\n if allSame {\n Message($\"Random generation should not return a fixed array.\");\n return false;\n }\n\n Message(\"Correct!\");\n true\n }\n}\n"
7712
7732
  },
7713
7733
  {
7714
7734
  "id": "key_distribution__prepare_qubits__Verification.qs",
@@ -1,4 +1,5 @@
1
1
  import type { ICodeAction, ICodeLens, ICompletionList, IHover, ILocation, INotebookMetadata, IPosition, IRange, ISignatureHelp, ITextEdit, IWorkspaceConfiguration, IWorkspaceEdit, VSDiagnostic } from "../../lib/web/qsc_wasm.js";
2
+ import { IProjectHost } from "../browser.js";
2
3
  import { IServiceProxy, ServiceProtocol } from "../workers/common.js";
3
4
  type QscWasm = typeof import("../../lib/web/qsc_wasm.js");
4
5
  export type LanguageServiceEvent = {
@@ -40,13 +41,11 @@ export interface ILanguageService {
40
41
  export declare const qsharpLibraryUriScheme = "qsharp-library-source";
41
42
  export type ILanguageServiceWorker = ILanguageService & IServiceProxy;
42
43
  export declare class QSharpLanguageService implements ILanguageService {
44
+ private wasm;
43
45
  private languageService;
44
46
  private eventHandler;
45
- private readFile;
46
47
  private backgroundWork;
47
- constructor(wasm: QscWasm, readFile?: (uri: string) => Promise<string | null>, listDir?: (uri: string) => Promise<[string, number][]>, getManifest?: (uri: string) => Promise<{
48
- manifestDirectory: string;
49
- } | null>);
48
+ constructor(wasm: QscWasm, host?: IProjectHost);
50
49
  updateConfiguration(config: IWorkspaceConfiguration): Promise<void>;
51
50
  updateDocument(documentUri: string, version: number, code: string): Promise<void>;
52
51
  updateNotebookDocument(notebookUri: string, version: number, metadata: INotebookMetadata, cells: {
@@ -3,12 +3,17 @@
3
3
  import { log } from "../log.js";
4
4
  export const qsharpLibraryUriScheme = "qsharp-library-source";
5
5
  export class QSharpLanguageService {
6
- constructor(wasm, readFile = () => Promise.resolve(null), listDir = () => Promise.resolve([]), getManifest = () => Promise.resolve(null)) {
6
+ constructor(wasm, host = {
7
+ readFile: async () => null,
8
+ listDirectory: async () => [],
9
+ resolvePath: async () => null,
10
+ findManifestDirectory: async () => null,
11
+ }) {
12
+ this.wasm = wasm;
7
13
  this.eventHandler = new EventTarget();
8
14
  log.info("Constructing a QSharpLanguageService instance");
9
15
  this.languageService = new wasm.LanguageService();
10
- this.backgroundWork = this.languageService.start_background_work(this.onDiagnostics.bind(this), readFile, listDir, getManifest);
11
- this.readFile = readFile;
16
+ this.backgroundWork = this.languageService.start_background_work(this.onDiagnostics.bind(this), host);
12
17
  }
13
18
  async updateConfiguration(config) {
14
19
  this.languageService.update_configuration(config);
package/dist/main.d.ts CHANGED
@@ -2,17 +2,14 @@ import { ICompiler, ICompilerWorker } from "./compiler/compiler.js";
2
2
  import { IDebugService, IDebugServiceWorker } from "./debug-service/debug-service.js";
3
3
  import { ILanguageService, ILanguageServiceWorker, qsharpLibraryUriScheme } from "./language-service/language-service.js";
4
4
  import type { ProjectLoader } from "../lib/web/qsc_wasm.js";
5
+ import { IProjectHost } from "./browser.js";
5
6
  export { qsharpLibraryUriScheme };
6
7
  export declare function getLibrarySourceContent(path: string): Promise<string | undefined>;
7
8
  export declare function getCompiler(): ICompiler;
8
- export declare function getProjectLoader(readFile: (path: string) => Promise<string | null>, loadDirectory: (path: string) => Promise<[string, number][]>, getManifest: (path: string) => Promise<{
9
- manifestDirectory: string;
10
- } | null>): ProjectLoader;
9
+ export declare function getProjectLoader(host: IProjectHost): ProjectLoader;
11
10
  export declare function getCompilerWorker(): ICompilerWorker;
12
11
  export declare function getDebugService(): IDebugService;
13
12
  export declare function getDebugServiceWorker(): IDebugServiceWorker;
14
- export declare function getLanguageService(readFile?: (uri: string) => Promise<string | null>, listDir?: (uri: string) => Promise<[string, number][]>, getManifest?: (uri: string) => Promise<{
15
- manifestDirectory: string;
16
- } | null>): ILanguageService;
13
+ export declare function getLanguageService(host?: IProjectHost): ILanguageService;
17
14
  export declare function getLanguageServiceWorker(): ILanguageServiceWorker;
18
15
  export * as utils from "./utils.js";
package/dist/main.js CHANGED
@@ -27,9 +27,9 @@ export function getCompiler() {
27
27
  ensureWasm();
28
28
  return new Compiler(wasm);
29
29
  }
30
- export function getProjectLoader(readFile, loadDirectory, getManifest) {
30
+ export function getProjectLoader(host) {
31
31
  ensureWasm();
32
- return new wasm.ProjectLoader(readFile, loadDirectory, getManifest);
32
+ return new wasm.ProjectLoader(host);
33
33
  }
34
34
  export function getCompilerWorker() {
35
35
  return createProxy("../compiler/worker-node.js", compilerProtocol);
@@ -41,9 +41,9 @@ export function getDebugService() {
41
41
  export function getDebugServiceWorker() {
42
42
  return createProxy("../debug-service/worker-node.js", debugServiceProtocol);
43
43
  }
44
- export function getLanguageService(readFile, listDir, getManifest) {
44
+ export function getLanguageService(host) {
45
45
  ensureWasm();
46
- return new QSharpLanguageService(wasm, readFile, listDir, getManifest);
46
+ return new QSharpLanguageService(wasm, host);
47
47
  }
48
48
  export function getLanguageServiceWorker() {
49
49
  return createProxy("../language-service/worker-node.js", languageServiceProtocol);
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  uid: Qdk.Microsoft.Quantum.Arrays.All
3
3
  title: All function
4
- ms.date: 06/13/2024 12:00:00 AM
4
+ ms.date: 06/26/2024 12:00:00 AM
5
5
  ms.topic: managed-reference
6
6
  qsharp.kind: function
7
7
  qsharp.namespace: Microsoft.Quantum.Arrays
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  uid: Qdk.Microsoft.Quantum.Arrays.Any
3
3
  title: Any function
4
- ms.date: 06/13/2024 12:00:00 AM
4
+ ms.date: 06/26/2024 12:00:00 AM
5
5
  ms.topic: managed-reference
6
6
  qsharp.kind: function
7
7
  qsharp.namespace: Microsoft.Quantum.Arrays
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  uid: Qdk.Microsoft.Quantum.Arrays.Chunks
3
3
  title: Chunks function
4
- ms.date: 06/13/2024 12:00:00 AM
4
+ ms.date: 06/26/2024 12:00:00 AM
5
5
  ms.topic: managed-reference
6
6
  qsharp.kind: function
7
7
  qsharp.namespace: Microsoft.Quantum.Arrays
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  uid: Qdk.Microsoft.Quantum.Arrays.CircularlyShifted
3
3
  title: CircularlyShifted function
4
- ms.date: 06/13/2024 12:00:00 AM
4
+ ms.date: 06/26/2024 12:00:00 AM
5
5
  ms.topic: managed-reference
6
6
  qsharp.kind: function
7
7
  qsharp.namespace: Microsoft.Quantum.Arrays
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  uid: Qdk.Microsoft.Quantum.Arrays.ColumnAt
3
3
  title: ColumnAt function
4
- ms.date: 06/13/2024 12:00:00 AM
4
+ ms.date: 06/26/2024 12:00:00 AM
5
5
  ms.topic: managed-reference
6
6
  qsharp.kind: function
7
7
  qsharp.namespace: Microsoft.Quantum.Arrays