Commit Graph

3 Commits

Author SHA1 Message Date
Artem Chikin 5945030af1 [Section] Do not diagnose static-initialization failure on an already-erroneous context
If we encounter an error prior to 'initialize-static-globals', this pass will not run, and will not convert globals to be statically-initialized at all, regardless of whether or not it would have been possible. This means that diagnostics on failure to do so would then always be emitted, likely as false-positives.

Avoid emitting these diagnostics in a context that contains a prior error.
As a future alternative, we could refine the conditions that make `initialize-static-globals` give up on a given function/value, but for now we need to ensure we do not emit spurious diagnostics.

Resolves rdar://172195372
2026-03-12 10:03:42 +00:00
Erik Eckstein 1c9a7cd562 SwiftCompilerSources: refactor DiagnosticEngine
* move it from the SIL to the AST module (where it belongs)
* change the signature of `diagnose` from `diagnose(location, .some_error)` to `diagnose(.some_error, at: location)`
* add an overload to allow passing a `SIL.Location` directly to `diagnose`
* add a `Diagnostic : Error` utility struct which allows throwing a `Diagnostic`
2025-04-18 06:58:38 +02:00
Artem Chikin 281f84da0f [Compile Time Values] Rewrite the 'Diagnose Unknown Compile Time Values' diagnostic pass in Swift 2025-03-28 10:30:07 -07:00