Skip to content

[WIP] Add existential structs to Checked C #683

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 86 commits into from
Sep 20, 2019
Merged
Changes from 1 commit
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
78bb3c2
Add a new existential type to the type hierarchy
Aug 10, 2019
aeae6b2
Handle existential types in different places
Aug 13, 2019
7f958ed
More handling of new ExistentialType
Aug 14, 2019
6aeb71e
Add new _Exists token
Aug 14, 2019
4163a7a
Handle existentials in a few more places
Aug 14, 2019
5372b6a
Handle existentials in additional places (including codegen)
Aug 14, 2019
f9ea757
[wip] Add an existential type to clang
Aug 14, 2019
e43194b
Desugar type variable in existential
Aug 14, 2019
b37ab7a
Fix bug in desugaring of exists
Aug 15, 2019
75c9c4c
Add dedicated scopes for existentials
Aug 15, 2019
413f16d
Rename some variables
Aug 15, 2019
0b01466
[wip] Instantiate existential types
Aug 16, 2019
fa606a4
Fix bugs
Aug 16, 2019
405fa0e
Better logic for determining whether an Existential is an aggregate
Aug 16, 2019
578203c
Disambiguate between expressions and decls in the parser
Aug 16, 2019
53a0f15
[wip] add a pack operation and start handling it all over the compiler
Aug 21, 2019
86aa6b2
Add support for pack in additional locations
Aug 21, 2019
b0b9b3f
Hook up pack operation in parser
Aug 21, 2019
8cbd3d8
[wip] parse pack expressions and generate ast node
Aug 21, 2019
7983ede
Can now parse pack expressions
Aug 21, 2019
8f4ff68
Codegen pack expressions
Aug 21, 2019
354cc6d
Slightly better merge function for existential types
Aug 21, 2019
b1e574d
Better caching of type applications and existentials
Aug 22, 2019
2f341be
Fix typo in comment
Aug 22, 2019
5b87c35
Check witness type in pack expressions
Aug 23, 2019
8c46da6
Add pack expression in the right place
Aug 26, 2019
1f6030d
[wip] parse unpack type specifiers
Aug 26, 2019
7c8e5e2
[wip] parse unpack specifiers
Aug 27, 2019
e5675cd
Move unpack to custom specifier
Aug 27, 2019
7690cb6
Differentiate between unpack variables in same scope
Aug 27, 2019
446b329
Add hacky rule for typing unpack init
Aug 28, 2019
d2452d8
bug fix
Sep 3, 2019
c6fe682
Minor fixes
Sep 3, 2019
bc84288
Restructure ExistentialType to contain more than a TypeVariableType f…
Sep 3, 2019
242988d
Fix evaluation kind resolution
Sep 4, 2019
4d8c235
Better canonical types for existentials
Sep 4, 2019
42ddb2a
Simplifying generation of canonical types
Sep 4, 2019
a546376
Fix bug in creating existential type
Sep 4, 2019
5b7ebc8
Revert changes to numbering of existential type variables
Sep 4, 2019
e34fd77
Fix bug in allocation logic
Sep 4, 2019
e531285
Implement a visitor that computes free variables
Sep 6, 2019
cbeadfa
Comment out logging code
Sep 6, 2019
b3f0c2e
Implement alpha renamer and wip canonical type generation
Sep 6, 2019
f669735
Hooked up canonicalization to creation of existential types
Sep 9, 2019
3267393
Fix bugs
Sep 9, 2019
3deb548
handle typedefs in alpha renamer
Sep 9, 2019
00306ea
handle type applications
Sep 9, 2019
f2eb814
fix bug
Sep 9, 2019
dc545f0
fix another bug
Sep 10, 2019
49fba21
remoev incorrect canonicalization
Sep 10, 2019
fd3bccc
fix bug in insertion to subst map
Sep 10, 2019
186570e
fix bug in checking witness type
Sep 10, 2019
cc5e1a0
Add TODO
Sep 11, 2019
629d1e3
fix codegen of type applications
Sep 11, 2019
9673f22
Remove unused static variable
Sep 17, 2019
a30a6bf
Emit parsing error while parsing existentials
Sep 17, 2019
3ff8f48
Improve wording
Sep 17, 2019
e1f0e38
Rename ExistTpe to ExistType
Sep 17, 2019
bc9d188
Improve wording
Sep 17, 2019
bd21568
Improve wording
Sep 17, 2019
007903f
Add issue number to TODOs
Sep 17, 2019
f23ff53
Improve wording
Sep 17, 2019
357545f
Add explanation
Sep 17, 2019
41f9283
Fix typo
Sep 17, 2019
92dce16
Check return type of pack expressions (must be an existential)
Sep 17, 2019
be767b8
Strengthen assertion
Sep 17, 2019
79ee960
Tag comments with issue number
Sep 17, 2019
50b0d76
Tag comment
Sep 17, 2019
a637a0c
Improve wording
Sep 17, 2019
9022551
Replace assertion by runtime error message
Sep 18, 2019
50cac91
Check that an unpack initializer has an existential type
Sep 18, 2019
4aa5032
Add comment about pack expressions being r-values
Sep 18, 2019
9c8fcfc
Remove unneeded comment
Sep 18, 2019
2645d62
Compute type linkage info in different way
Sep 18, 2019
298162c
Tag comment
Sep 18, 2019
485b99e
Improve comment
Sep 18, 2019
0d4b28e
Tag comment
Sep 18, 2019
766f068
Check for malformed unpacks
Sep 18, 2019
c0403de
Fix warning and missing symbol
Sep 19, 2019
07102de
Add missing switch case
Sep 19, 2019
de74377
Partially disable clang test
Sep 19, 2019
40b584c
Fix codegen check
Sep 19, 2019
02c5dc3
Fix typo
Sep 19, 2019
13774ae
Improve handling of linkage for existentials
Sep 19, 2019
c10b52a
Use getAs() instead of manually getting canonical type
Sep 19, 2019
3d0caff
Address code review comment
Sep 19, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Check for malformed unpacks
  • Loading branch information
Abel Nieto committed Sep 18, 2019
commit 766f0683d800b7f89825f2fd0d2e377dadbc6a2e
7 changes: 2 additions & 5 deletions lib/Parse/ParseDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7418,10 +7418,8 @@ void Parser::ParseCheckedPointerSpecifiers(DeclSpec &DS) {
/// [Checked C] Parse a specifier for an existential type.
/// exist-spec:
/// _Exists '(' type-var , type ')'
/// TODO: use the proper names for the non-terminals above.
void Parser::ParseExistentialTypeSpecifier(DeclSpec &DS) {
assert(Tok.is(tok::kw__Exists) && "Expected an '_Exists' token");
// TODO: do we need a try-finally to handle the scopes?
EnterScope(Scope::DeclScope | Scope::ExistentialTypeScope);
ParseExistentialTypeSpecifierHelper(DS);
ExitScope();
Expand All @@ -7430,7 +7428,6 @@ void Parser::ParseExistentialTypeSpecifier(DeclSpec &DS) {
/// [Checked C] Parse an unpack type specifier.
/// unpack-spec:
/// '_Unpack' '(' type-var ')'
/// TODO: use the proper names for the non-terminals above.
void Parser::ParseUnpackSpecifier(DeclSpec &DS) {
assert(Tok.is(tok::kw__Unpack) && "Expected an '_Unpack' token");
auto StartLoc = ConsumeToken(); // eat '_Unpack'
Expand All @@ -7439,8 +7436,8 @@ void Parser::ParseUnpackSpecifier(DeclSpec &DS) {
if (ExpectAndConsume(tok::l_paren)) return;

if (Tok.getKind() != tok::identifier) {
// TODO: add proper error message
printf("expected a type variable name\n");
Diag(Tok.getLocation(), diag::err_type_variable_identifier_expected);
SkipUntil(tok::r_paren, StopAtSemi);
return;
}

Expand Down