diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2018-08-27 16:14:48 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2018-08-27 16:14:48 -0400 |
| commit | 526d8425abf91b33e828b964f7d55d70e17780bf (patch) | |
| tree | b19d4b1a31d66d6a1f30f32506249c016b6e0e9b /src/analyze.cpp | |
| parent | 68e2794e1543f91ab8f984127018820897cc0521 (diff) | |
| download | zig-526d8425abf91b33e828b964f7d55d70e17780bf.tar.gz zig-526d8425abf91b33e828b964f7d55d70e17780bf.zip | |
fix false negative determining if function is generic
This solves the smaller test case of #1421 but the
other test case is still an assertion failure.
Diffstat (limited to 'src/analyze.cpp')
| -rw-r--r-- | src/analyze.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp index a8b3ea7132..54dd84f166 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -1575,7 +1575,7 @@ static TypeTableEntry *analyze_fn_type(CodeGen *g, AstNode *proto_node, Scope *c switch (type_entry->id) { case TypeTableEntryIdInvalid: - return g->builtin_types.entry_invalid; + zig_unreachable(); case TypeTableEntryIdUnreachable: case TypeTableEntryIdUndefined: case TypeTableEntryIdNull: @@ -1703,6 +1703,11 @@ static TypeTableEntry *analyze_fn_type(CodeGen *g, AstNode *proto_node, Scope *c case TypeTableEntryIdUnion: case TypeTableEntryIdFn: case TypeTableEntryIdPromise: + if ((err = type_ensure_zero_bits_known(g, fn_type_id.return_type))) + return g->builtin_types.entry_invalid; + if (type_requires_comptime(fn_type_id.return_type)) { + return get_generic_fn_type(g, &fn_type_id); + } break; } |
