Commit Graph

77 Commits

Author SHA1 Message Date
Sophia Poirier
51824937f2 [Variadic Generics] fixit for pack expansion on a non-pack generic type 2023-03-07 14:00:44 -08:00
Holly Borla
74cc62735b [RequirementMachine] Diagnose same-element requirements.
The rewrite rules are not quite right yet for same-element requirements, so
let's ban them for now.
2023-03-06 21:32:30 -08:00
Holly Borla
721b846e16 [ConstraintSystem] Don't propagate errors for invalid DeclRefs in the pattern
of a pack expansion.
2023-03-06 10:51:43 -08:00
Holly Borla
8012e45109 [Diagnostics] Diagnose pack element expressions containing a non-pack subexpression. 2023-03-05 00:11:54 -08:00
Holly Borla
e063f02a42 [ConstraintSystem] Handle invalid pack element bindings during PackElementOf
simplification.
2023-03-04 19:43:43 -08:00
Holly Borla
34b720c0a3 [CSGen] Constraint generation for PackExpansionExpr should return a null type
if the constraint system has not recorded a type for an expanded pack element
type repr.
2023-03-04 13:14:16 -08:00
Holly Borla
a8ca989072 [PreCheckExpr] Allow pack references when resolving types during TypeExpr folding. 2023-03-04 12:35:01 -08:00
Sophia Poirier
70cffb06f3 [Variadic Generics] type parameter pack syntax change: T... -> each T 2023-03-02 14:42:28 -08:00
Holly Borla
509188630b [ConstraintSystem] Implement type checking for converting a tuple to a
pack using the `.element` syntax.
2023-02-28 22:56:59 -08:00
Sophia Poirier
0e99f9c6e5 [Variadic Generics] require pack ident type within a pack expansion to form a pack reference 2023-01-27 13:17:12 -08:00
Holly Borla
6725f365ba [Variadic Generics] Update tests for syntax changes. 2023-01-07 09:50:14 -08:00
Holly Borla
89fa17d74c [Parser] Replace postfix ellipsis with a prefix 'repeat' keyword for pack
expansion expressions, and create them in the parser instead of during
pre-checking in the constraint system.
2023-01-07 09:49:14 -08:00
Holly Borla
e966b4ef7d [CSDiagnostics] Add an error message for pack expansion expressions over
packs that don't have the same shape.
2022-12-21 08:25:10 -05:00
Holly Borla
b8ce8997e5 [Test] Add tests for pack element reprs outside pack expansion expressions. 2022-12-20 17:08:46 -05:00
Holly Borla
7b35e85d31 [PreCheckExpr] Consider postfix ellipsis expressions containing 'each' type
reprs to be pack expansion expressions.
2022-12-20 11:36:58 -05:00
Holly Borla
42020792c6 [Sema] Represent pack element references in pack expansion patterns as
PackElementExpr.
2022-12-14 20:45:52 -08:00
Holly Borla
10adbddddd [ConstraintSystem] Correct the first type of the ShapeOf constraint when
generating constraints for PackExpansionExpr.

The result pattern type of a pack expansion doesn't always contain pack
references. Instead, use the type of the first pack reference binding.
2022-11-24 00:01:58 -05:00
Holly Borla
bdab953f64 [GenericEnvironment] Handle parameter packs in opened element signatures in
getOrCreateArchetypeFromInterfaceType.

Instead of special casing parameter packs for primary generic environments,
handle parameter packs in each kind of environment. For opened element
environments, a pack archetype can be produced from the outer substitutions.
2022-11-23 15:10:07 -05:00
Holly Borla
c1dcb9c6f1 [FrontendOptions] Remove bespoke experimental feature flags for ImplicitSome and
VariadicGenerics in favor of -enable-experimental-feature X.
2022-11-11 10:14:08 -08:00
Holly Borla
d864cebef3 [TypeResolution] Enable local variable packs. 2022-10-26 17:04:23 -07:00
Holly Borla
032c511754 [ConstraintSystem] Add a PackElementOf constraint to delay mapping opened
element pattern types to pattern archetypes until after type variables are
resolved.
2022-10-24 19:46:44 -07:00
Holly Borla
7354ad30c3 [ConstraintSystem] Use opened element types for opaque values in pack expansions. 2022-10-24 18:11:00 -07:00
Holly Borla
ad962d8ed1 [AST] Allow tuple types with consecutive pack expansions. 2022-10-23 22:45:47 -07:00
Holly Borla
596edde3ef [CSApply] Implement coerceToType for pack expansion expressions. 2022-10-23 22:44:22 -07:00
Holly Borla
13a17ef918 [ConstraintSystem] Use reduced shape types when generating constraints for pack
expansion expressions.
2022-10-23 20:25:38 -07:00
Holly Borla
5584752b3e [ConstraintSystem] Implement value parameter pack forwarding. 2022-10-22 13:41:48 -07:00
Holly Borla
dab3b64c99 [ConstraintSystem] Implement basic type checking for pack expressions.
During prechecking, postfix '...' expressions are rewritten to pack
expansion expressions if the operand contains pack references. References
to packs are replaced with opaque values, and the pack expansion stores
the opaque value bindings to decl refs.
2022-10-22 13:41:48 -07:00