Skip to content

Add code fix for double literal without dot#3352

Open
amcasey wants to merge 6 commits into
mainfrom
amcasey/i2d
Open

Add code fix for double literal without dot#3352
amcasey wants to merge 6 commits into
mainfrom
amcasey/i2d

Conversation

@amcasey

@amcasey amcasey commented Jun 17, 2026

Copy link
Copy Markdown
Member

It's very easy to write 2 when you mean 2.. Offer a code fix.

@amcasey

amcasey commented Jun 17, 2026

Copy link
Copy Markdown
Member Author

I don't really care whether we merge this. I make this mistake pretty regularly in Q#, but I mostly implemented it to practice writing rust without copilot.

With all the time in the world, I'd probably experiment with having type inference infer either Int or Double for integer literals, depending on the context. In such a world, we might want a suffix to force the literal to Int, but the only place I can think of where both are allowed and the difference matters is division.

operation Foo(qs: Qubit[]) : Unit is Adj {
use q = Qubit();
Foo(q);
Foo(◉◉q◉◉);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When we switched from one edit to two, the updated text became less meaningful as confirmation that the action was behaving correctly, so now we check the locations of the edits too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant