Commit Graph

5 Commits

Author SHA1 Message Date
Tim Kientzle
f73cfa7396 Reflection tests are incompatible with ASAN 2024-07-26 09:55:08 -07:00
Hiroshi Yamauchi
ed58501ecd Account for the generic zero-sized payload enum cases.
Disable the assert:

    // At least one payload is non-empty (otherwise this                                                                                                                  // would get laid out as a non-payload enum)                                                                                                                          assert(getNumNonEmptyPayloadCases() > 0);

in TaggedMultiPayloadEnumTypeInfo because it fails when you have
generic but zero-sized payload enum cases.

Also remove unnecessary "REQUIRES: objc_interop" lines from the enum
reflection tests.
2023-09-21 09:31:24 -07:00
Tim Kientzle
2f27e06591 Generalize tests that already work for 32 bits 2023-04-06 13:27:06 -07:00
Tim Kientzle
e573366a53 Fix handling of generic MPEs
This exercises a number of cases that the previous logic got
wrong, including cases where MPEs are laid out like SPEs,
and cases where we use the SPE or MPE layout strategies for enums
that have no non-empty payloads.  (These cases are superficially
similar but differ in how they handle XIs.)

These new tests allowed me to correct a number logical flaws
about how layouts are selected.  In particular, cases with
generic payloads are always considered to be non-empty for
purposes of selecting a layout strategy.  Only cases that
are statically known to be empty are considered empty for
layout purposes.
2023-04-02 21:09:24 -07:00
Tim Kientzle
1232424b44 RemoteMirror generic multi-payload-enum fixes (#41903)
Apparently, RemoteMirror chokes on certain MPEs with generic payload types.
It does not recognize the generic payload type so ends up defaulting to a
zero size.  This causes the overall enum size to be miscalculated unless there
is another non-generic payload that's at least as large.

The case below requires us to reprocess the metatype to "thicken" it.
That process inadvertently lost information about the depth of generic
nesting, which caused the RemoteMirror to be unable to resolve the type of
`C.E.t` at runtime.
```
  class C<T> {
    enum E<T> {
    case t(T)
    case u(Int)
    }
    var e: E<T>?
  }
```

Solution: add code to the thickening logic to recursively thicken
parent types to preserve the nesting of generics.

Resolves rdar://90490128
2022-03-28 14:47:17 -07:00