Using generic return type can cause "Error: undeclared field" for some UFCS call styles
### Description

If you have a proc that returns a generic, 'object' style UFCS will fail, whereas 'functional' style will work. 

e.g. contrived example:

```nim
type
  Foo* = ref object
    discard

  Bar* = ref object 
    discard

# Foo isn't actually needed, but it's to demonstrate the issue.
proc convert[T](self: Foo, val: ref object): T = 
  return (T) val

var foo = Foo()
var bar : ref object = Bar()

## This works
let aa = convert[Bar](foo, bar)
echo aa.repr

## This doesn't work
let bb = foo.convert[Bar](bar)
echo bb.repr
```



### Nim Version

Nim Compiler Version 2.2.0 [MacOSX: arm64]
Compiled at 2024-11-18
Copyright (c) 2006-2024 by Andreas Rumpf

git hash: 78983f1876726a49c69d65629ab433ea1310ece1
active boot switches: -d:release

### Current Output

```text
Error: undeclared field: 'convert' for type generic_fail.Foo
```


### Expected Output

```text
No error
```


### Known Workarounds

Use the UFCS style that works

### Additional Information

_No response_