use fmt;
use io;
use bufio;
use memio;
use os;
use fs;
use strings;
use types;
use encoding::utf8;
export fn main() void = {
const file = os::open("app.ha")!;
const file_scan = bufio::newscanner(file, types::SIZE_MAX);
for(true) {
const line = match(bufio::scan_line(&file_scan)) {
case let line: str => yield line;
case io::EOF => break;
case utf8::invalid => fmt::fatal("Fatal error");
case io::error => fmt::fatal("Fatal error");
};
};
};
Is it compiler bug or an error in code?
On Fri Feb 2, 2024 at 1:13 PM CET, Dmitry B wrote:
> use fmt;
> use io;
> use bufio;
> use memio;
> use os;
> use fs;
> use strings;
> use types;
> use encoding::utf8;
>
> export fn main() void = {
>
> const file = os::open("app.ha")!;
> const file_scan = bufio::newscanner(file, types::SIZE_MAX);
>
> for(true) {
> const line = match(bufio::scan_line(&file_scan)) {
> case let line: str => yield line;
> case io::EOF => break;
> case utf8::invalid => fmt::fatal("Fatal error");
> case io::error => fmt::fatal("Fatal error");
>
> };
> };
>
> };
>
> Is it compiler bug or an error in code?
case let line: str
should be
case let line: const str
The compiler should detect that and report an error, but we haven't
implemented that yet.