Constructor that takes Func parameter in wrong order in inherited class can cause rock to crash #856

Closed
davidhesselbom opened this Issue Jan 16, 2015 · 0 comments

Projects

None yet

2 participants

@davidhesselbom
Contributor

I'm not sure this isn't covered in another issue somewhere, but

A: class {
    init: func (callback: Func (Int), value: Int)
}

B: class extends A { // Wrong order of parameters
    init: func (value: Int, callback: Func (Int))
}

makes rock crash during the resolving stage:

0     Backtrace class()                                                   in lang/Backtrace               (at /home/david/versioned/ooc/tools/rock/sdk/lang/Backtrace.ooc:285)               
1     Exception getCurrentBacktrace()                                     in lang/Exception               (at /home/david/versioned/ooc/tools/rock/sdk/lang/Exception.ooc:209)               
2     _signalHandler()                                                    in lang/Exception               (at /home/david/versioned/ooc/tools/rock/sdk/lang/Exception.ooc:269)               
3     killpg()                                                            in                              (at (null):0)                                                                      
4     ArrayList getSize()                                                 in structs/ArrayList            (at /home/david/versioned/ooc/tools/rock/sdk/structs/ArrayList.ooc:68)             
5     FunctionDecl resolve_impl()                                         in rock/middle/FunctionDecl     (at /home/david/versioned/ooc/tools/rock/source/rock/middle/FunctionDecl.ooc:567)  
6     TypeDecl resolve_impl()                                             in rock/middle/TypeDecl         (at /home/david/versioned/ooc/tools/rock/source/rock/middle/TypeDecl.ooc:597)      
7     ClassDecl resolve_impl()                                            in rock/middle/ClassDecl        (at /home/david/versioned/ooc/tools/rock/source/rock/middle/ClassDecl.ooc:81)      
8     TypeDecl resolve_impl()                                             in rock/middle/TypeDecl         (at /home/david/versioned/ooc/tools/rock/source/rock/middle/TypeDecl.ooc:615)      
9     ClassDecl resolve_impl()                                            in rock/middle/ClassDecl        (at /home/david/versioned/ooc/tools/rock/source/rock/middle/ClassDecl.ooc:81)      
10    Module resolve_impl()                                               in rock/middle/Module           (at /home/david/versioned/ooc/tools/rock/source/rock/middle/Module.ooc:524)        
11    Resolver process_impl()                                             in rock/middle/tinker/Resolver  (at /home/david/versioned/ooc/tools/rock/source/rock/middle/tinker/Resolver.ooc:59)
12    Tinkerer process_impl()                                             in rock/middle/tinker/Tinkerer  (at /home/david/versioned/ooc/tools/rock/source/rock/middle/tinker/Tinkerer.ooc:90)
13    __rock_frontend_CommandLine_rock_frontend_CommandLine_closure311()  in rock/frontend/CommandLine    (at /home/david/versioned/ooc/tools/rock/source/rock/frontend/CommandLine.ooc:660) 
14    Time runTime()                                                      in os/Time                      (at /home/david/versioned/ooc/tools/rock/sdk/os/Time.ooc:134)                      
15    CommandLine postParsing_impl()                                      in rock/frontend/CommandLine    (at /home/david/versioned/ooc/tools/rock/source/rock/frontend/CommandLine.ooc:664) 
16    CommandLine parse_impl()                                            in rock/frontend/CommandLine    (at /home/david/versioned/ooc/tools/rock/source/rock/frontend/CommandLine.ooc:634) 
17    CommandLine init()                                                  in rock/frontend/CommandLine    (at /home/david/versioned/ooc/tools/rock/source/rock/frontend/CommandLine.ooc:536) 
18    CommandLine new()                                                   in rock/frontend/CommandLine    (at /home/david/versioned/ooc/tools/rock/source/rock/frontend/CommandLine.ooc:30)  
19    main()                                                              in                              (at /home/david/versioned/ooc/tools/rock/source/rock/rock.ooc:2)                   
20    libc_start_main()                                                   in                              (at /build/buildd/eglibc-2.19/csu/libc-start.c:321)                                
21    _start()                                                            in                              (at (null):0)                                                                      

Changing B to any of the following

B: class extends A { // Suffix
    init: func~B (value: Int, callback: Func (Int))
}
B: class extends A { // Fewer parameters before the Func one 
    init: func (callback: Func (Int))
}
B: class extends A { // More parameters before the Func one
    init: func (value, value2: Int, callback: Func (Int))
}
B: class extends A { // Same order of parameters as in parent class
    init: func (callback: Func (Int), value: Int)
}

makes the problem go away, but with

B: class extends A { // More parameters AFTER the Func one
    init: func (value: Int, callback: Func (Int), value2: Int)
}

it still happens.

@davidhesselbom davidhesselbom changed the title from Overriding constructor with Func parameter can crash to Overriding constructor that takes Func parameter can cause rock to crash Jan 16, 2015
@davidhesselbom davidhesselbom changed the title from Overriding constructor that takes Func parameter can cause rock to crash to Inherited class constructor that takes Func parameter in wrong order can cause rock to crash Jan 16, 2015
@davidhesselbom davidhesselbom changed the title from Inherited class constructor that takes Func parameter in wrong order can cause rock to crash to Class constructor that takes Func parameter in wrong order in inherited class can cause rock to crash Jan 16, 2015
@davidhesselbom davidhesselbom changed the title from Class constructor that takes Func parameter in wrong order in inherited class can cause rock to crash to Constructor that takes Func parameter in wrong order in inherited class can cause rock to crash Jan 16, 2015
@zhaihj zhaihj referenced this issue in zhaihj/rock Jan 17, 2015
@zhaihj zhaihj Check argtypes ab071ea
@fasterthanlime fasterthanlime modified the milestone: 0.9.10 Jul 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment