Skip to content

[bug] Generics not supported #252

@bsnelson

Description

@bsnelson

🐞Bug Report

Bug Description

Gremlins does not support generics, which were added to Go as of 1.18. Specifically the union operator ("|") allows type constraints to contain multiple types. Gremlins incorrectly labels this as an INVERT_BITWISE operation and declares it "NOT COVERED" regardless of tests.

To Reproduce

Steps to reproduce the behavior:

  1. Create a trivial go program that uses a type interface with union, e.g.:
    type IntorString interface { ~int | ~string }
  2. Create a test file that tests the program
  3. Create a .gremlins.yml as thus:
    unleash:
    mutants:
    invert-bitwise:
    enabled: true
  4. Execute gremlins unleash
  5. Result will contain:
    NOT COVERED INVERT_BITWISE at ....

Expected behaviour

Gremlins will ignore the | characters, as they are not bitwise operators in this context

Screenshots

Operating System

Should be platform agnostic

Additional Context

Metadata

Metadata

Assignees

Labels

c/bugCategory: A issue or PR related to a bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions