mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
The main fixes here are: - we weren't looking through open-existentials in the l-value - we weren't handling mutating gets correctly unless CSApply wrapped the base in an InOutExpr, which seems to be multifile-sensitive - we were missing diagnostics in some cases involving subscripts A better fix would be to re-introduce LValueAccessKind, but I wanted a workable short-term fix that I could try to get into 5.1. Fixes rdar://49482742, which is specific to the lazy-getter problem.
18 lines
541 B
Swift
18 lines
541 B
Swift
// RUN: %target-swift-frontend -emit-sil -verify -primary-file %s %S/Inputs/external_lazy_property.swift
|
|
// RUN: %target-swift-frontend -emit-sil -verify -primary-file %s -primary-file %S/Inputs/external_lazy_property.swift
|
|
|
|
// rdar://45712204
|
|
func test1(s: Test1) {
|
|
_ = s.property // expected-error {{cannot use mutating getter on immutable value: 's' is a 'let' constant}}
|
|
}
|
|
|
|
func test2(s: Test2) {
|
|
_ = s.property
|
|
}
|
|
|
|
// rdar://49482742 - shouldn't warn about 's' never being mutated
|
|
func test3() {
|
|
var s = Test1()
|
|
_ = s.property
|
|
}
|