hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 4a79c7e413d14730d55aeb13dffaf6850344bd99
parent eda5cb6b46896bd3c847ebfcd9aac3892c352827
Author: Sebastian <sebastian@sebsite.pw>
Date:   Mon, 11 Apr 2022 20:05:49 -0400

parse: test long function prototype

Signed-off-by: Sebastian <sebastian@sebsite.pw>

Diffstat:
Mcmd/haredoc/tty.ha | 4++--
Mhare/parse/+test/unit.ha | 7++++++-
Mhare/unparse/type.ha | 4++--
3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/cmd/haredoc/tty.ha b/cmd/haredoc/tty.ha @@ -197,13 +197,13 @@ fn prototype_tty( // lines const linelen = if (len(t.params) == 0) { let strm = strio::dynamic(); - defer io::close(&strm)!; + defer io::close(&strm); type_tty(&strm, indent, *t.result)?; retname = strings::dup(strio::string(&strm)); yield 0z; // only use one line if there's no parameters } else { let strm = strio::dynamic(); - defer io::close(&strm)!; + defer io::close(&strm); let linelen = indent * 8 + 5; linelen += if (len(t.params) != 0) len(t.params) * 3 - 1 else 0; for (let i = 0z; i < len(t.params); i += 1) { diff --git a/hare/parse/+test/unit.ha b/hare/parse/+test/unit.ha @@ -127,7 +127,12 @@ fn tup_to_import(tup: import_tuple) ast::import = ast::import { "def foo::bar: int = void;\n\n" "@symbol(\".f9$oo\") fn foo(bar: int, baz: int...) void;\n\n" "@test fn foo(_: int, ...) void;\n\n" - "export fn main() void = void;\n"); + "export fn main() void = void;\n\n" + "fn long(\n" + "\tfirst: *const void,\n" + "\tsecond: (void | rune | str),\n" + "\tthird: size...\n" + ") nullable *const void;\n"); }; @test fn docs() void = { diff --git a/hare/unparse/type.ha b/hare/unparse/type.ha @@ -78,13 +78,13 @@ export fn prototype( // lines const linelen = if (len(t.params) == 0) { let strm = strio::dynamic(); - defer io::close(&strm)!; + defer io::close(&strm); _type(&strm, indent, *t.result)?; retname = strings::dup(strio::string(&strm)); yield 0z; // only use one line if there's no parameters } else { let strm = strio::dynamic(); - defer io::close(&strm)!; + defer io::close(&strm); let linelen = indent * 8 + 5; linelen += if (len(t.params) != 0) len(t.params) * 3 - 1 else 0; for (let i = 0z; i < len(t.params); i += 1) {