Skip to content

Edge case for unreachable case inspection; ordering of cases #3927

Open
@bclothier

Description

@bclothier

Here's a case that doesn't fire inspection but should:

Select Case True
    Case Record(0) = &HEB And Record(1) = &HBB And Record(2) = &HBF
       'UTF8
    Case Record(0) = &HFE And Record(1) = &HFF
       'UTF-16 BE
    Case Record(0) = &HFF And Record(1) = &HFE
       'UTF-16 LE
    Case Record(0) = &H0 And Record(1) = &H0 And Record(2) = &HFE And Record(3) = &HFF
       'UTF-32 BE
    Case Record(0) = &HFF And Record(1) = &HFE And Record(2) = &H0 And Record(3) = &H0
       'UTF-32 LE
    Case False
End Select

The last 2 clauses are technically unreachable because the more looser check will be evaluated before the more stricter ones. I added Caes False to see if I would get a inspection result; I didn't.

The correct ordering should be:

Select Case True
    Case Record(0) = &HEB And Record(1) = &HBB And Record(2) = &HBF
       'UTF-8
    Case Record(0) = &H0 And Record(1) = &H0 And Record(2) = &HFE And Record(3) = &HFF
       'UTF-32 BE
    Case Record(0) = &HFF And Record(1) = &HFE And Record(2) = &H0 And Record(3) = &H0
       'UTF-32 LE
    Case Record(0) = &HFE And Record(1) = &HFF
       'UTF-16 BE
    Case Record(0) = &HFF And Record(1) = &HFE
       'UTF-16 LE
End Select

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIdentifies work items for known bugsdifficulty-03-duckInvolves more challenging problems and/or developing within and revising the internals APIedge-caseMarks a bug as an edge case that would be nice to fix, but that likely doesn't affect normal use.feature-inspectionshelp wantedup-for-grabsUse this label in conjunction with a difficulty level label, e.g. difficulty-02-ducky

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions