microsoft / AL

Home of the Dynamics 365 Business Central AL Language extension for Visual Studio Code. Used to track issues regarding the latest version of the AL compiler and developer tools available in the Visual Studio Code Marketplace or as part of the AL Developer Preview builds for Dynamics 365 Business Central.
MIT License
748 stars 245 forks source link

Error when publishing a case with type Joker #7832

Open gatchrat opened 3 months ago

gatchrat commented 3 months ago

Please include the following with each issue:

1. Describe the bug When creating a switch case on a value of the type joker, the compiler will not throw an error, but publishing the App will.

2. To Reproduce Steps to reproduce the behavior:

  1. Create a case on a value of Type Joker
procedure Example()
    var
        RecordRef: RecordRef;
        newFieldRef: FieldRef;
    begin

        RecordRef.Close();
        RecordRef.Open(77);
        if RecordRef.FindFirst() then begin
            newFieldRef := RecordRef.Field(3);
            case newFieldRef.Value of
                1:
                    Message('Hello');
            end;
        end;

    end;
  1. Publish

3. Expected behavior Either the compiler throws an error immediatly, or i can successfully publish.

4. Actual behavior The compiler throws neither Error nor Warning, but on publish i get:

The request for path /BC/dev/apps?tenant=default&SchemaUpdateMode=synchronize&DependencyPublishingOption=default failed with code UnprocessableEntity. Reason: Failure while emitting method. Object:'Codeunit Example' Method:'Example()' (Unexpected value 'Joker' of type 'Microsoft.Dynamics.Nav.CodeAnalysis.NavTypeKind')
Unexpected value 'Joker' of type 'Microsoft.Dynamics.Nav.CodeAnalysis.NavTypeKind'

5. Versions:

Final Checklist

Please remember to do the following:

Internal work item: AB#546897

BazookaMusic commented 3 months ago

Compilation error