forked from nim-lang/Nim
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
block ambiguous type conversion dotcalls in generics
fixes nim-lang#22373
- Loading branch information
Showing
5 changed files
with
57 additions
and
0 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,7 @@ | ||
# module a for t22373 | ||
|
||
# original: | ||
type LightClientHeader* = object | ||
|
||
# simplified: | ||
type TypeOrTemplate* = object |
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,18 @@ | ||
# module b for t22373 | ||
|
||
import m22373a | ||
|
||
# original: | ||
type | ||
LightClientDataFork* {.pure.} = enum | ||
None = 0, | ||
Altair = 1 | ||
template LightClientHeader*(kind: static LightClientDataFork): auto = | ||
when kind == LightClientDataFork.Altair: | ||
typedesc[m22373a.LightClientHeader] | ||
else: | ||
static: raiseAssert "Unreachable" | ||
|
||
# simplified: | ||
template TypeOrTemplate*(num: int): untyped = | ||
typedesc[m22373a.TypeOrTemplate] |
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,16 @@ | ||
# issue #22373 | ||
|
||
import m22373a | ||
import m22373b | ||
|
||
# original: | ||
template lazy_header(name: untyped): untyped {.dirty.} = | ||
var `name _ ptr`: ptr[data_fork.LightClientHeader] # this data_fork.Foo part seems required to reproduce | ||
proc createLightClientUpdates(data_fork: static LightClientDataFork) = | ||
lazy_header(attested_header) | ||
createLightClientUpdates(LightClientDataFork.Altair) | ||
|
||
# simplified: | ||
proc generic[T](abc: T) = | ||
var x: abc.TypeOrTemplate | ||
generic(123) |
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