[SR-11748] Compiler does not reject invalid code #54155
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
crash
Bug: A crash, i.e., an abnormal termination of software
run-time crash
Bug → crash: Swift code crashed during execution
type checker
Area → compiler: Semantic analysis
Additional Detail from JIRA
md5: 31af41d148da11ed6947d843fb431c4a
duplicates:
Issue Description:
To reproduce:
1. Create
foo.swift
with the following contents:Then, run the file by executing
swift foo.swift
, or alternately, just compile the file by executingswiftc foo.swift
.When running the binary produced by
swiftc
, I get the following output:When running the file with
swift
I get the following output:I believe the right behavior is to reject the program at compile time, as protocol
P
can no longer be used as an existential type, due to the use ofSelf
as a return value of thesubscript
.The text was updated successfully, but these errors were encountered: