[MLton] New front-end finds bug in basis library

Jared M Showalter jareds@mit.edu
Mon, 19 Jan 2004 22:27:41 -0500 (EST)

The reader and writer types in BinIO.StreamIO are not the same as in
BinPrimIO.  So, the following program should elaborate if the basis
library is conformant, but it doesn't:

type r = BinIO.StreamIO.reader
val f : r -> r = fn x : BinPrimIO.reader => x


Error: test.sml 2.5: pattern and expression disagree
   pattern:    [r] -> [r]
   expression: [BinPrimIO.reader] -> [BinPrimIO.reader]
   in: (f): (r -> r) = fn ((x): BinPrimIO.reader) => (x)
compilation aborted: elaborate reported errors

This appears to be a bug in the basis library the is caught by the new
front-end, rather than a bug in the front-end, because of the following
excerpt from the output of 'mlton -show-basis true':

structure BinIO:
      structure StreamIO:
	    type reader = BinIO.StreamIO.reader
	    type writer = BinIO.StreamIO.writer

structure TextIO:
      structure StreamIO:
	    type reader = TextPrimIO.reader
	    type writer = TextPrimIO.writer

TextIO has it right, but BinIO doesn't.