20000712 bug report

Stephen J. Bevan sbevan@echarge.com
Thu, 10 Aug 2000 09:58:39 -0700


Included are a couple of programs that I made as small as I could
(though I'm sure they could be smaller) that display some undesirable
behaviour :-

  amidala$ uname -a
  Linux amidala 2.2.9-19mdk #1 Wed May 19 19:53:00 GMT 1999 i686 unknown
  amidala$ mlton -v
  MLton 20000712 created this file on Wed Aug  9 20:24:08 2000.
  Do not edit this file.
  Flag settings: 
     aux: false
     canDefunctorize: false
     chunk: coalesce 2000
     defines: [NODEBUG]
     fixed heap: None
     includes: [mlton.h]
     inline: NonRecursive Some(50)
     inline rounds: 1
     input file: 
     instrument: false
     instrument Sxml: false
     keep Cps: false
     match: left to right
     messages: true
     mode: compile
     polyvariance: Some({rounds = 2, small = 30, product = 300})
     print at fun entry: false
     profile: false
  amidala$ cat gen1.sml
  fun message s = TextIO.output(TextIO.stdErr, s ^ "\n")

  fun die msg =
    (message "Usage: gen [ -p prefix ]"
    ; message("Error: " ^ msg)
    ; Process.exit failure)



  fun main () = 
    let
      val prefix = ref "xxx.";
      fun args [] = ()
        | args ("-p":t) = 
            case t of
              [] => 
            | (p:t) => (prefix := p; args t)

    in
      ()
    end;


  args CommandLine.arguments();

  val _ = main ();
  amidala$ mlton gen1.sml
  gen1.sml:17.0-17.0 Error: unhandled exception in parser
  mlton: bug: compilation aborted: parse reported errors


Whilst the position gives me something to go on, it is not the most
helpful error message.  It reminds me of the default from YACC: "parse
error" :-)


  amidala$ cat gen2.sml
  fun println s = TextIO.output(TextIO.stdErr, s ^ "\n")

  fun die msg =
    ( println "Usage: gen [ -p prefix ]"
    ; println ("Error: " ^ msg)
    ; OS.Process.exit OS.Process.failure
    )



  local
    val prefix = ref "xxx.";
    fun args [] = ()
      | args ("-p"::t) = 
          (case t of
            [] => die "oops"
          | (p::t) => (prefix := p; args t))
  in
    fun main () = args CommandLine.arguments();
  end;

  val _ = main ();
  amidala$ mlton gen2.sml
  mlton: bug: unify Con
  amidala$ 

There might well be a problem unifying a constructor but a line number
would be nice :-)