mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
AST/SILGen: Requestify var initializer expression typechecking.
Allow initializer expressions to be emitted during SILGen when `-experimental-lazy-typecheck` is specified by introducing a new request that fully typechecks the init expressions of pattern binding declarations on-demand. There are still a few rough edges, like missing support for wrapped properties and incomplete handling of subsumed initializers. Fixing these issues is not an immediate priority because in the short term `-experimental-lazy-typecheck` will always be accompanied by `-enable-library-evolution` and `-experimental-skip-non-exportable-decls`. This means that only the initializers of properties on `@frozen` types will need to be emitted and property wrappers are not yet fully supported on properties belonging to `@frozen` types. Resolves rdar://117448868
This commit is contained in:
@@ -68,10 +68,11 @@ protected:
|
||||
// clang-format off
|
||||
union { uint64_t OpaqueBits;
|
||||
|
||||
SWIFT_INLINE_BITFIELD_BASE(Pattern, bitmax(NumPatternKindBits,8)+1+1,
|
||||
SWIFT_INLINE_BITFIELD_BASE(Pattern, bitmax(NumPatternKindBits,8)+1+1+1,
|
||||
Kind : bitmax(NumPatternKindBits,8),
|
||||
isImplicit : 1,
|
||||
hasInterfaceType : 1
|
||||
hasInterfaceType : 1,
|
||||
executableInitChecked : 1
|
||||
);
|
||||
|
||||
SWIFT_INLINE_BITFIELD_FULL(TuplePattern, Pattern, 32,
|
||||
@@ -104,6 +105,7 @@ protected:
|
||||
Bits.Pattern.Kind = unsigned(kind);
|
||||
Bits.Pattern.isImplicit = false;
|
||||
Bits.Pattern.hasInterfaceType = false;
|
||||
Bits.Pattern.executableInitChecked = false;
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -136,6 +138,11 @@ public:
|
||||
bool isImplicit() const { return Bits.Pattern.isImplicit; }
|
||||
void setImplicit() { Bits.Pattern.isImplicit = true; }
|
||||
|
||||
bool executableInitChecked() const {
|
||||
return Bits.Pattern.executableInitChecked;
|
||||
}
|
||||
void setExecutableInitChecked() { Bits.Pattern.executableInitChecked = true; }
|
||||
|
||||
/// Find the smallest subpattern which obeys the property that matching it is
|
||||
/// equivalent to matching this pattern.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user