Skip to content

Quickfix: prevent despecialisation of annotations list#53155

Merged
vtjnash merged 1 commit intoJuliaLang:masterfrom
tecosaur:quickfix-annotio-type-inference
Feb 5, 2024
Merged

Quickfix: prevent despecialisation of annotations list#53155
vtjnash merged 1 commit intoJuliaLang:masterfrom
tecosaur:quickfix-annotio-type-inference

Conversation

@tecosaur
Copy link
Copy Markdown
Member

@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
Copy Markdown
Member 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
Copy Markdown
Member

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

@tecosaur
Copy link
Copy Markdown
Member 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
@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