Bad error message when returning object with missing generic
### Description

This code passes `nim check` but then fails to compile. Previously it returned an error when checking. 
```nim
type
  Foo[T] = object
    x: string
    
proc initFoo(): Foo[string] =
  Foo(x: "hello")

discard initFoo()
```

### Nim Version

Nim Compiler Version 2.2.1 [Linux: amd64]
Compiled at 2024-10-27
Copyright (c) 2006-2024 by Andreas Rumpf

git hash: 24aa92c14f2301d1ef63f59bc4ae2ec31a64f9c5
active boot switches: -d:release


### Current Output

```text
nim.nim                  nim
nim.nim                  handleCmdLine
main.nim                 mainCommand
main.nim                 compileToBackend
main.nim                 commandCompileToC
pipelines.nim            compilePipelineProject
pipelines.nim            compilePipelineModule
pipelines.nim            processPipelineModule
pipelines.nim            processPipeline
cgen.nim                 genTopLevelStmt
cgen.nim                 genProcBody
ccgstmts.nim             genStmts
ccgexprs.nim             expr /home/jake/Documents/projects/Nim/x.nim(3, 3) nkStmtList
ccgexprs.nim             genStmtList
ccgstmts.nim             genStmts
ccgexprs.nim             expr /home/jake/Documents/projects/Nim/x.nim(3, 3) nkStmtList
ccgexprs.nim             genStmtList
ccgstmts.nim             genStmts
ccgexprs.nim             expr /home/jake/Documents/projects/Nim/x.nim(9, 1) nkDiscardStmt
cgen.nim                 initLocExprSingleUse
ccgexprs.nim             expr /home/jake/Documents/projects/Nim/x.nim(9, 16) nkStmtListExpr
ccgexprs.nim             genStmtListExpr
ccgstmts.nim             genStmts
ccgexprs.nim             expr /home/jake/Documents/projects/Nim/x.nim(9, 16) nkFastAsgn
ccgstmts.nim             genAsgn
ccgstmts.nim             loadInto
ccgcalls.nim             genAsgnCall
ccgcalls.nim             genPrefixCall
cgen.nim                 initLocExpr
ccgexprs.nim             expr /home/jake/Documents/projects/Nim/x.nim(9, 9) nkSym
cgen.nim                 genProc
cgen.nim                 genProcNoForward
cgen.nim                 genProcAux
injectdestructors.nim    injectDestructorCalls
injectdestructors.nim    p
injectdestructors.nim    moveOrCopy
injectdestructors.nim    p
types.nim                lookupFieldAgain
assertions.nim           failedAssertImpl
assertions.nim           raiseAssert
Error: unhandled exception: types.nim(1916, 11) `ty.kind in {tyTuple, tyObject}`  [AssertionDefect]
```


### Expected Output
Either the previous message
```text
Error: type mismatch: got 'Foo' for 'Foo(x: "hello")' but expected 'Foo[system.string]'
```
Or have the generic inferred


### Known Workarounds

_No response_

### Additional Information

Fails with `--mm:refc` also, but in ccgexprs.nim