-
Notifications
You must be signed in to change notification settings - Fork 52
Open
Labels
bugSomething isn't workingSomething isn't working
Description
While looking into why the standard library wasn't building correctly for me, I found that that readByte for StandardInput
was trying to call an incompatible mono in the generated c code.
In the source I found that the implementations of the readByte and writeByte functions in the instances for StandardInput and StandardError respectively did not have the correct types in the function definition.
The typeclass definition demands that the instance type parameter matches the stream type
-- standard/src/IO/IO.aui
typeclass ByteInputStream(T: Type) is
generic [R: Region]
method readByte(stream: &![T, R]): Option[Nat8];
end;
But the implementation does not follow this
-- standard/src/IO/Terminal.aum
instance ByteInputStream(StandardInput) is
generic [R: Region]
method readByte(stream: &![StandardOutput, R]): Option[Nat8] is
let stdin: Address[Nat8] := getStdin();
let res: Int32 := fgetc(stdin);
if res = EOF then
return None();
else
return toNat8(res);
end if;
end;
end;
I have created a PR to fix the discrepancy in this code, but surely this should be getting caught by the type checker?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working