Commit Graph

5 Commits

Author SHA1 Message Date
Allan Shortlidge
b97e27279e Sema: Fix opaque type accessors with inactive availability conditions.
Opaque type metadata accessor functions could be miscompiled for functions that
contain `if #available` checks for inactive platforms. For example, this
function will always return `A` when compiled for macOS, but the opaque type
accessor would instead return the type metadata for `B`:

```
func f() -> some P {
  if #available(iOS 99, *) {
    return A() // Returns an A on macOS
  } else {
    return B()
  }
}
```

Resolves rdar://139487970.
2024-11-10 09:23:39 -08:00
Joe Groff
1adf2aeb87 Update IRGen tests for opaque pointers 2023-06-23 06:57:37 -07:00
Arnold Schwaighofer
c1a93e0bde Move tests over to use the %use_no_opaque_pointers option 2023-06-14 10:49:48 -07:00
Dario Rexin
bdbab35453 [IRGen] Use ConditionalDominanceScope in AbstractMetadataAccessor::emit (#64585)
* [IRGen] Use ConditionalDominanceScope in AbstractMetadataAccessor::emit

rdar://103179745

Under certain conditions the missing dominance scope caused a cached witness table ref to be used in a block that it was not available in.

* Fix target in test
2023-03-23 18:34:27 -07:00
Pavel Yaskevich
4fe16f5bf5 [IRGen] Augment opaque type descriptor to support limited availability underlying types
If particular opaque type descriptor has multiple conditionally available
underlying types, emit a special type and witness reference accessors that
would be called at runtime to determine actual underlying type.
2022-04-01 13:11:35 -07:00