-
-
Notifications
You must be signed in to change notification settings - Fork 777
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
Same warning printed twice #3899
Comments
Oh dear! Thank you |
Looking into this more, it's very strange. This code prints the warning twice: import gleam/list
pub fn main() {
use <- fn(f) { f() }
list.concat([])
} However, this doesn't: import gleam/list
fn usable(f) { f() }
pub fn main() {
use <- usable
list.concat([])
} It only seems to occur if the deprecated value is used inside a It also prints more times if in several nested import gleam/list
pub fn main() {
use <- fn(f) { f() }
use <- fn(f) { f() }
use <- fn(f) { f() }
list.concat([])
// ^ This deprecation warning prints 16 times!
} It does not seem to matter which deprecated value is used. |
Oops, ahahaha I presume we're checking for deprecations in the body once before and once after use is expanded? |
Yes that's what I thought too. Could be related to the recent changes to the ast representation of use, when the desugar code action was introduced. Or this could have always been the case, just never noticed before. I'll test on 1.6.2 and then bisect it later. |
Ok, so it looks like it was first introduced in 1.5 in d022ff0. My guess is that |
d022ff0#diff-892d21f7b2f39e0c5d4ef6a85f69d96b223f6cd4309106ac900cf9c391abb183R2911 Looks like it's doing some wasteful cloning there too? It clones the call arg but discards the original? |
Ok, so looking into this issue more, it's a bit tricky to figure out a way to get this to work. Basically:
I'll have a play around with it a bit more to try and figure out a solution without breaking any existing behaviour |
My
list.concat
deprecation warning is being printed twice for the same line/occurrence.Reproduction
Versions
Log
log.txt
The text was updated successfully, but these errors were encountered: