Skip to content

Instantly share code, notes, and snippets.

@cgranade
Last active January 22, 2020 05:04
Show Gist options
  • Save cgranade/471654e721ff80ca8de8c80a954f6d20 to your computer and use it in GitHub Desktop.
Save cgranade/471654e721ff80ca8de8c80a954f6d20 to your computer and use it in GitHub Desktop.
Reproduction for `long?` bug
# The same image used by mybinder.org
FROM mcr.microsoft.com/quantum/iqsharp-base:0.10.1912.0501
ENV IQSHARP_HOSTING_ENV=cgranade-longq-bug-repro
# Make sure the contents of our repo are in ${HOME}
# Required for mybinder.org
COPY . ${HOME}
USER root
RUN chown -R ${USER} ${HOME}
USER ${USER}
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"application/json": "{\"rows\":[{\"@type\":\"@tuple\",\"Item1\":\"iqsharp\",\"Item2\":\"0.10.1912.501\"},{\"@type\":\"@tuple\",\"Item1\":\"Jupyter Core\",\"Item2\":\"1.2.20112.0\"},{\"@type\":\"@tuple\",\"Item1\":\".NET Runtime\",\"Item2\":\".NETCoreApp,Version=v3.0\"}]}",
"text/html": [
"<table><thead><tr><th>Component</th><th>Version</th></tr></thead><tbody><tr><td>iqsharp</td><td>0.10.1912.501</td></tr><tr><td>Jupyter Core</td><td>1.2.20112.0</td></tr><tr><td>.NET Runtime</td><td>.NETCoreApp,Version=v3.0</td></tr></tbody></table>"
],
"text/plain": [
"Component Version\n",
"------------ ------------------------\n",
"iqsharp 0.10.1912.501\n",
"Jupyter Core 1.2.20112.0\n",
".NET Runtime .NETCoreApp,Version=v3.0\n"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"%version"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"application/json": "[\"PrepareCatState\"]",
"text/html": [
"<ul><li>PrepareCatState</li></ul>"
],
"text/plain": [
"PrepareCatState"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"operation PrepareCatState(register : Qubit[]) : Unit {\n",
" H(register[0]);\n",
" for (target in register[1...]) {\n",
" CNOT(register[0], target);\n",
" }\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
": error IQS000: Could not compile Roslyn dll from working folder.\n",
": error CS1503: Argument 1: cannot convert from 'long?' to 'long'\n"
]
}
],
"source": [
"operation PrepareCatState(register : Qubit[]) : Unit is Adj {\n",
" H(register[0]);\n",
" for (target in register[1...]) {\n",
" CNOT(register[0], target);\n",
" }\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"application/json": "[\"PrepareCatState\"]",
"text/html": [
"<ul><li>PrepareCatState</li></ul>"
],
"text/plain": [
"PrepareCatState"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"operation PrepareCatState(register : Qubit[]) : Unit is Ctl {\n",
" H(register[0]);\n",
" for (target in register[1...]) {\n",
" CNOT(register[0], target);\n",
" }\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
": error IQS000: Could not compile Roslyn dll from working folder.\n",
": error CS1503: Argument 1: cannot convert from 'long?' to 'long'\n",
": error CS1503: Argument 1: cannot convert from 'long?' to 'long'\n"
]
}
],
"source": [
"operation PrepareCatState(register : Qubit[]) : Unit is Adj + Ctl {\n",
" H(register[0]);\n",
" for (target in register[1...]) {\n",
" CNOT(register[0], target);\n",
" }\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Q#",
"language": "qsharp",
"name": "iqsharp"
},
"language_info": {
"file_extension": ".qs",
"mimetype": "text/x-qsharp",
"name": "qsharp",
"version": "0.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment