soul-lang / SOUL

The SOUL programming language and API
Other
1.71k stars 96 forks source link

How to debug internal compiler errors? #41

Closed nickdima closed 3 years ago

nickdima commented 3 years ago

Trying to figure out how to handle this internal compiler error:

error: Internal compiler error: ""canBeArrayElementType()" failed at createArray:262"
cesaref commented 3 years ago

Sounds like you've found a problem - can you post the code causing this, and we'll investigate

nickdima commented 3 years ago

I tried to simplify the code as much as possibile while still keeping it to brake and ended up with this. The problem seems to be the float array that I'm trying to pass as an event parameter.

graph Main  [[ main ]]
{
    input event soul::midi::Message  midiIn;
    output stream float<2>                audioOut;

    let
    {
        voices  = SamplePlayer[16];
        control = Control;
    }

    connection
    {
        midiIn -> soul::midi::MPEParser -> control -> voices -> audioOut;
    }
}

processor SamplePlayer
{
    input event (float[]) sliceIn;

    output stream float<2> audioOut;

    event sliceIn (float[] slice)
    {
    }

    void run()
    {
        loop
        {
            advance();
        }
    }
}

processor Control
{
    input event (soul::note_events::NoteOn) eventIn;
    output event float[] sliceOut [16];

    event eventIn (soul::note_events::NoteOn e)
    {
        float[10] slice;
        sliceOut[1] << slice;
    }

    void run()
    {
        loop
        {
            advance();
        }
    }
}
cesaref commented 3 years ago

Thanks for that - the problem here is that you are declaring a two dimensional array, when declaring the sliceOut event in Control - it might not look like it, but you've got an array of sliceOut of float arrays. I've updated the compiler to produce a sensible error message in this compiler, and this will be included in the next release.