Skip to content

LECC runtime errors when running the following function. #11

@rdwebster

Description

@rdwebster

The following code produces LECC runtime errors when run:

test :: (String, Int) -> Int;
public test !pair = 
    case pair of
    (str, num) ->
        let
            result = 1 + num;
        in
            if num == 0 then 
                case Nothing of
                Nothing -> 
                    result;
            else
                result;
    ;

running: Cal.Test.Core.Prelude_Tests.test ("foo", 1)
Error while executing: Fatal Executor error.
Caused by: java.lang.NoClassDefFoundError: org/openquark/cal_Cal_Test_Core_Prelude__Tests/Test, Detail: org/openquark/cal_Cal_Test_Core_Prelude__Tests/Test

With LECC source generation enabled:
Cal.Test.Core.Prelude_Tests:CAL: Compilation unsuccessful because of errors:
Error: Code generation aborted. Error generating code for: Cal.Test.Core.Prelude_Tests.test Detail: Unable to retrieve MachineFunction for Cal.Test.Core.Prelude_Tests.test$result$4. Caused by: org.openquark.cal.internal.machine.CodeGenerationException

A more complex version of the test:

test2 :: Int -> Map Int String;
public test2 !unused = 
    let
        simpleAddToAccum :: Map Int String -> (String, Int) -> Map Int String;
        simpleAddToAccum !accum inputVal = 
            case inputVal of
            (val, ord) -> 
                let
                    defaultInsertResult :: Map Int String;
                    defaultInsertResult = Map.insert ord val accum;
                in
                    if False then 
                        case Nothing of
                        Nothing -> 
                            defaultInsertResult;
                    else
                        defaultInsertResult;
            ;
    in
        simpleAddToAccum Map.empty ("test", 5);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions