Skip to content

[Bug] The converter for type class matching ( enums ) works unexpectedly  #13843

@PixeyeHQ

Description

@PixeyeHQ

The converter for type class matching (enums ) works unexpectedly with procs having more than one argument of the converted type (?)

Current Output

type
  IdLayer {.pure, size: int.sizeof.} = enum
    Core
    Ui
  IdScene {.pure, size: int.sizeof.} = enum
    Game
    Shop 
  SomeIds = IdLayer|IdScene
 
converter toint*(x: SomeIds): int = x.int

var IdGame : int = IdScene.Game #works

## method that get ints 
bind_scene(Core,Game)         # doesn't work, type mismatch for Game, doesnt convert to int
bind_scene(Core,IdScene.Game) # doesn't work, type mismatch for Game, doesnt convert to int
bind_scene(Core,IdGame)       # works 

Expected Output

type
  IdLayer {.pure, size: int.sizeof.} = enum
    Core
    Ui
  IdScene {.pure, size: int.sizeof.} = enum
    Game
    Shop 
  SomeIds = IdLayer|IdScene
 
converter toint*(x: SomeIds): int = x.int

## method that gets ints 
bind_scene(Core, Game) 

Additional Information

$ nim -v
Nim Compiler Version 1.0.6
Nim Compiler Version 1.2.0 ( devel )

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions