aboutsummaryrefslogtreecommitdiff
path: root/src/parser.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2019-07-07 14:14:28 +0100
committergingerBill <bill@gingerbill.org>2019-07-07 14:14:28 +0100
commit8e722274f03f211b1cb1e3599caf921a35abb4b9 (patch)
tree1388ab61d02371b0440321be993667fd5f5d4ab2 /src/parser.cpp
parentfd62959bf4876d86edf5ebc507ff16167da28469 (diff)
Disallow blank identifier polymorphic types $_
Diffstat (limited to 'src/parser.cpp')
-rw-r--r--src/parser.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/parser.cpp b/src/parser.cpp
index 89290c9a2..ff6a03fb6 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -1379,6 +1379,9 @@ Ast *parse_ident(AstFile *f, bool allow_poly_names=false) {
} else if (allow_poly_names && token.kind == Token_Dollar) {
Token dollar = expect_token(f, Token_Dollar);
Ast *name = ast_ident(f, expect_token(f, Token_Ident));
+ if (is_blank_ident(name)) {
+ syntax_error(name, "Invalid polymorphic type definition with a blank identifier");
+ }
return ast_poly_type(f, dollar, name, nullptr);
} else {
token.string = str_lit("_");
@@ -1831,6 +1834,9 @@ Ast *parse_operand(AstFile *f, bool lhs) {
case Token_Dollar: {
Token token = expect_token(f, Token_Dollar);
Ast *type = parse_ident(f);
+ if (is_blank_ident(type)) {
+ syntax_error(type, "Invalid polymorphic type definition with a blank identifier");
+ }
Ast *specialization = nullptr;
if (allow_token(f, Token_Quo)) {
specialization = parse_type(f);