Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quickfix: prevent despecialisation of annotations list #53155

Merged
merged 1 commit into from
Feb 5, 2024

Conversation

tecosaur
Copy link
Contributor

@tecosaur tecosaur commented Feb 2, 2024

In f117a50 code modifying annotations via list comprehensions was
introduced. However, when (1) there are annotations present and (2) all
annotations are filtered out, this comprehension is inferred to a wider
type incompatible with the AnnotatedString constructor. This can be
fixed by changing the first element of the tuple to directly use the
UnitRange{Int} constructor, which stops it being inferred as an Any.

@tecosaur tecosaur added strings "Strings!" bugfix This change fixes an existing bug labels Feb 2, 2024
In f117a50 code modifying annotations via list comprehensions was
introduced. However, when (1) there are annotations present and (2) all
annotations are filtered out, this comprehension is inferred to a wider
type incompatible with the AnnotatedString constructor. This can be
fixed by changing the first element of the tuple to directly use the
UnitRange{Int} constructor, which stops it being inferred as an Any.
@tecosaur tecosaur force-pushed the quickfix-annotio-type-inference branch from 093ee91 to 8f83286 Compare February 2, 2024 06:40
@tecosaur
Copy link
Contributor Author

tecosaur commented Feb 4, 2024

I can confirm that test failures are completely unrelated (it's just the Mingw32 Windows builds). For any committers who stumble across this, this should be a pretty easy merge 🤞.

@oscardssmith
Copy link
Member

I do wonder whether the AnnotatedString constructor should be widened, but this looks reasonable to me.

@tecosaur
Copy link
Contributor Author

tecosaur commented Feb 4, 2024

It used to accept a whole variety of forms, but I recall some thinking along the lines of it being better to widen as needs arise than pre-emptively.

Thanks for taking a look at this!

@vtjnash vtjnash merged commit 28db6c7 into JuliaLang:master Feb 5, 2024
6 of 8 checks passed
@tecosaur tecosaur deleted the quickfix-annotio-type-inference branch August 11, 2024 04:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix This change fixes an existing bug strings "Strings!"
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants