-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix #24912 #24913
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Graveflo
wants to merge
17
commits into
nim-lang:devel
Choose a base branch
from
Graveflo:dot_constructor
base: devel
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+111
−24
Open
fix #24912 #24913
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
309a1f7
idk
Graveflo 9169f14
test and change
Graveflo 8e34971
patch
Graveflo 62f7bf6
fix test
Graveflo a9a2f44
owned
Graveflo 0919d87
adjust test
Graveflo 2ed5744
support call operator
Graveflo 6b0b152
remove some garbage
Graveflo 5a80734
patch
Graveflo 16625a2
nil checks - remove dead code
Graveflo 495350f
nil again
Graveflo 91b03a9
try this
Graveflo 4e940b7
use `efNoUndeclared`
Graveflo dd9b0c5
come on
Graveflo ffe1130
whitespace
Graveflo 67d5782
helper 1
Graveflo d6dec6f
not needed?
Graveflo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,63 @@ | ||
discard """ | ||
action: run | ||
""" | ||
|
||
#24913 | ||
block: | ||
type | ||
A = object | ||
b: int | ||
B = object | ||
b: proc(x: float): int | ||
|
||
proc b(T: typedesc[A]; s: float): int = 5 | ||
proc b(T: typedesc[B]; s: float): int = 7 | ||
proc testme(x: float): int = 3 | ||
doAssert A.b(1.0) == 5 | ||
doAssert B.b(1.0) == 7 | ||
doAssert B(b: testme).b(1.0) == 3 | ||
|
||
block: | ||
type | ||
Proc[T] = proc(text: T): int {.closure.} | ||
|
||
Rule[T] = object | ||
p: Proc[T] | ||
|
||
proc p(x: Rule[int]; y: float): int = 5 | ||
proc sp(y: int): int = 3 | ||
|
||
proc spring[T](rule: Rule[T]) = | ||
let p = proc (text: T) = | ||
doAssert rule.p(text) == 3 | ||
p(default(T)) | ||
|
||
Rule[int](p: sp).spring() | ||
|
||
block: | ||
type | ||
A = object | ||
|
||
proc new(T: type A): ref A = | ||
let c = (ref T)() | ||
c | ||
|
||
proc p[K](rng=A.new()) = | ||
discard new(A) | ||
|
||
p[int]() | ||
|
||
# cant be in a block | ||
type | ||
Cont[T] = ref RootObj | ||
Rule[T] = object | ||
p: Cont[T] | ||
|
||
proc p(x: Rule[int]; y: int): int = 5 | ||
|
||
proc spring[T](rule: Rule[T]) = | ||
let p = proc (x: T) = | ||
doAssert rule.p(x) == 5 | ||
p(default(T)) | ||
|
||
Rule[int]().spring() |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use a helper proc here and document what the heck is actually does and why it needs to do it. The compiler code is already incomprehensible with all these arbitrary transformations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pulled out the part that is new. The rest is stuff that got re-positioned.