-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Open
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.regressiontriage neededThis issue needs more specific labelsThis issue needs more specific labels
Description
Description
As title said.
Reproduction
protocol Fooable {
func doSomething()
}
struct Foo1: Fooable {
func doSomething() {
print("foo1 do something")
}
}
struct Foo2: Fooable {
func doSomething() {
print("foo2 do something")
}
}
@inline(never)
func callFunc() {
var foo: Fooable? = Foo2()
foo = Foo1()
// expecting "foo1 do something"
// actual output: "foo2 do something"
foo?.doSomething()
}
callFunc()Expected behavior
The program prints "foo1 do something".
Environment
Reproduciable starting with Swift 6.1 on all supported platforms
Additional information
Compiler explorer repro: https://godbolt.org/z/5aYPd8Wzh
ChengzhiHuang and CrazyFanFan
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.regressiontriage neededThis issue needs more specific labelsThis issue needs more specific labels