-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
disable weird type inference for object constructors (#24455)
closes #24372, refs #20091 This was added in #20091 for some reason but doesn't actually work and only makes error messages more obscure. So for now, it's disabled. Can also be backported to 2.0 if necessary. (cherry picked from commit a610f23)
- Loading branch information
Showing
2 changed files
with
19 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# issue #24372 | ||
|
||
type | ||
Foo[T] = object | ||
x: string | ||
|
||
proc initFoo(): Foo[string] = | ||
Foo(x: "hello") #[tt.Error | ||
^ cannot instantiate: 'Foo[T]'; the object's generic parameters cannot be inferred and must be explicitly given]# | ||
|
||
discard initFoo() |