Ticket #113 (new task)

Opened 5 months ago

Overloading of local functions is not implemented.

Reported by: sukyoungryu Assigned to: dr2chase
Priority: major Milestone:
Component: interpreter Version:
Keywords: Cc:

Description

Overloading of local functions is not implemented.

For example, running the following program:

component overloadedLocalFunctions
  export Executable
  run(args:String...) = do
    printType(x: Any) = println (x ": " typeName x)
    typeName(_: ())      = "()"
    typeName(_: ZZ32)    = "ZZ32"
    typeName(_: RR64)    = "RR64"
    typeName(_: Boolean) = "Boolean"
    typeName(_: Char)    = "Char"
    typeName(_: String)  = "String"
    typeName(_: Any)     = "Any"
    printType 5.7; printType true; printType 'c'
  end
end

yields the following error messages:

not_passing_yet/overloadedLocalFunctions.fss:21:33~50: Failed to find any matching overload, args = (5.7), overload = {
         PENDING BELOW
*       typeName(_:()) ()->Anynot_passing_yet/overloadedLocalFunctions.fss:22:4~23:4
*       typeName(_:ZZ32) ZZ32->Anynot_passing_yet/overloadedLocalFunctions.fss:23:4~24:4
*       typeName(_:RR64) RR64->Anynot_passing_yet/overloadedLocalFunctions.fss:24:4~25:4
*       typeName(_:Boolean) Boolean->Anynot_passing_yet/overloadedLocalFunctions.fss:25:4~26:4
*       typeName(_:Char) Char->Anynot_passing_yet/overloadedLocalFunctions.fss:26:4~27:4
*       typeName(_:String) String->Anynot_passing_yet/overloadedLocalFunctions.fss:27:4~28:4
*       typeName(_:Any) Any->Anynot_passing_yet/overloadedLocalFunctions.fss:28:4~29:4}:OverloadedFunction
Context:
not_passing_yet/overloadedLocalFunctions.fss:21:33~50
not_passing_yet/overloadedLocalFunctions.fss:21:33~50
not_passing_yet/overloadedLocalFunctions.fss:29:4~17