[MLton] overloading bug

Matthew Fluet fluet@cs.cornell.edu
Sun, 16 Nov 2003 09:28:25 -0500 (EST)


The following program:

val z : Int16.int = 1
val y = z + 2
val x = (valOf Int16.minInt) + z

generates the following errors:

Error: z.sml 1.5: pattern and expression disagree
   pattern:    Int16.int
   expression: int
   in: (z): Int16.int = 1
Error: z.sml 2.11: function applied to incorrect argument
   expects: _ * Int16.int
   but got: _ * int
   in: + (z, 2)
Error: z.sml 2.11: impossible use of overloaded var: +
   (Int16.int * Int16.int) -> Int16.int
Error: z.sml 3.30: impossible use of overloaded var: +
   (Int16.int * Int16.int) -> Int16.int


The same errors arise with Int8 and Int64, although Int, Int32, LargeInt,
and IntInf all are type-checked correctly.