Bogus `attempting to call undeclared routine` (related to `std/jsonutils`).
### Description

# imported.nim
```nim
import std/[json, jsonutils]

type
  Kind* = enum kind1
  Foo* = ref object
    bleh: string
    case kind*: Kind  # Remove these lines and everything works 🤡
    of kind1: discard # Remove these lines and everything works 🤡

proc unserialize*[T](s: string) =
  discard jsonTo(parseJson(s), T)
```

# main.nim
```nim
import imported
# import std/[json, jsonutils] # Add this line and everything works 🤡

unserialize[Foo](":)")
```

### Nim Version

2.2.0
(

### Current Output

```text
❯ nim c main
Hint: used config file '/Users/dawid/.choosenim/toolchains/nim-2.2.0/config/nim.cfg' [Conf]
Hint: used config file '/Users/dawid/.choosenim/toolchains/nim-2.2.0/config/config.nims' [Conf]
............................................................................................................
/Users/dawid/Desktop/unfun/netchess/tmp/main.nim(4, 17) template/generic instantiation of `unserialize` from here
/Users/dawid/Desktop/unfun/netchess/tmp/imported.nim(11, 17) template/generic instantiation of `jsonTo` from here
/Users/dawid/.choosenim/toolchains/nim-2.2.0/lib/std/jsonutils.nim(296, 11) template/generic instantiation of `fromJson` from here
/Users/dawid/.choosenim/toolchains/nim-2.2.0/lib/std/jsonutils.nim(237, 15) template/generic instantiation of `fromJson` from here
/Users/dawid/.choosenim/toolchains/nim-2.2.0/lib/std/jsonutils.nim(264, 23) template/generic instantiation of `discKeysMatch` from here
/Users/dawid/.choosenim/toolchains/nim-2.2.0/lib/std/jsonutils.nim(206, 23) template/generic instantiation of `discKeysMatchBodyGen` from here
/Users/dawid/.choosenim/toolchains/nim-2.2.0/lib/std/jsonutils.nim(202, 33) template/generic instantiation of `discKeyMatch` from here
/Users/dawid/.choosenim/toolchains/nim-2.2.0/lib/std/jsonutils.nim(190, 11) template/generic instantiation of `fromJson` from here
/Users/dawid/.choosenim/toolchains/nim-2.2.0/lib/std/jsonutils.nim(221, 31) template/generic instantiation of `fmt` from here
(1, 2) Error: attempting to call undeclared routine: 'pretty'
```
```


### Expected Output

_No response_

### Known Workarounds

_No response_

### Additional Information

_No response_