Skip to content

Internal compiler error #16

@ellerh

Description

@ellerh

The compiler runs into a problem with this code even if it seems to be type-correct (SML/NJ and PolyML accept it):

functor Slice (type 'a elt
               type 'a seq
               val sub : 'a seq * int -> 'a elt) =
  struct
    datatype 'a slice = SLICE of 'a seq
    fun app f (SLICE s) = f (sub (s, 0))
  end

functor MonoSlice (type elt
                   type seq
                   val sub : seq * int -> elt) =
  struct
    structure S = Slice (type 'a elt = elt
                         type 'a seq = seq
                         val sub = sub)
    val app = S.app
    type slice = elt S.slice
    type elt = elt
  end

signature MONO_SLICE =
  sig
      type elt
      type slice
      val app : (elt -> unit) -> slice -> unit
  end

structure S : MONO_SLICE = MonoSlice (type elt = CharVector.elem
                                      type seq = CharVector.vector
                                      val sub = CharVector.sub)

For instance the interpreter stops with an "Exception Zip":

mlworks -tty
Use: /home/helmut/.mlworks
val it : unit = ()
MLWorks 2.1 Professional Edition
Copyright (C) 1999 Harlequin Group plc.  All rights reserved.
MLWorks is a trademark of Harlequin Group plc.

MLWorks> use "test.sml";
Use: /tmp/test.sml
functor MonoSlice
functor Slice
signature MONO_SLICE =
  sig
    type elt
    type slice
    val app : (elt -> unit) -> slice -> unit
  end
Entering Debugger, scanning stack ... done.
Exception Zip[_lists.sml:128.15-128.17] raised
Entering debugger, commands: q : quit (return to listener),  ? : more help
Current (innermost) stack frame:
No visible frame
Debugger> 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions