Confusing location <unknown>:0:
in errors about sending self risking data races
#81757
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
triage needed
This issue needs more specific labels
Description
When using a function name to create a closure and trying to save that closure, the implicit capture of
self
seems to create a very confusing error message without a location, which for large modules can be very hard to find.Reproduction
Add the following to
test/Concurrency/transfernonsendable.swift
When executing the test, I get the following output (the first error is correctly reported, but I am concerned with the rest of the errors):
The reference to
c
seems to captureself
, but the captures ofself
seems to not be correctly located for the diagnostics, and uses<unknown>:0:
as location, which in a large piece of code is difficult to pin point (here the good error helps, but in the more complicated case I was investigating the<unknown>:0:
were the only errors.Expected behavior
The errors should at least point to the line
a.block = c
.Environment
I was working on a branch recently synchronized with Swift 6.2, but I have been debugging where the errors seems to be produced and the code on
main
seems not have been changed in a while, so I am almost sure it still reproduces inmain
.Additional information
@gottesmm you are the author of the code that generate those diagnostics, if you don't mind checking this issue. I have been trying to figure out where the invalid location is coming from, but this is not a part of the compiler I am very familiar with.
The text was updated successfully, but these errors were encountered: