-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Closed as duplicate of#70323
Closed as duplicate of#70323
Copy link
Labels
SILaccepts invalidBug: Accepts invalidBug: Accepts invalidbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfcrashBug: A crash, i.e., an abnormal termination of softwareBug: A crash, i.e., an abnormal termination of softwaredefinite initializationArea → compiler → SIL: Definite initializationArea → compiler → SIL: Definite initializationmemory safetyFeature: memory safetyFeature: memory safetyscript modeFlag: Specific to script mode compilationFlag: Specific to script mode compilationswift 6.0
Description
Description
The code produces a runtime error instead of a compile-time error. I would anticipate this to be an error that could be identified during compile-time.
It's worth mentioning that removing the print
and having just instance.x
allows the compiled binary to execute without any runtime errors (exit code 0).
Reproduction
class SomeClass {
let x: Int = 0
}
print(instance.x)
var instance = SomeClass()
Expected behavior
I expect this to be a compile-time error
Environment
swift-driver version: 1.87.1 Apple Swift version 5.9 (swiftlang-5.9.0.128.108 clang-1500.0.40.1)
Target: arm64-apple-macosx14.0
Additional information
No response
Metadata
Metadata
Assignees
Labels
SILaccepts invalidBug: Accepts invalidBug: Accepts invalidbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfcrashBug: A crash, i.e., an abnormal termination of softwareBug: A crash, i.e., an abnormal termination of softwaredefinite initializationArea → compiler → SIL: Definite initializationArea → compiler → SIL: Definite initializationmemory safetyFeature: memory safetyFeature: memory safetyscript modeFlag: Specific to script mode compilationFlag: Specific to script mode compilationswift 6.0