Skip to content
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

proc type mismatch with static[int] generic params #6177

Closed
jxy opened this issue Aug 3, 2017 · 0 comments
Closed

proc type mismatch with static[int] generic params #6177

jxy opened this issue Aug 3, 2017 · 0 comments

Comments

@jxy
Copy link
Contributor

jxy commented Aug 3, 2017

type                                                                                                 
  G[N,M:static[int],T] = object                                                                      
    o: T                                                                                             
                                                                                                     
proc newG[N,M:static[int],T](x:var G[N,M,T], y:T) =                                                  
  x.o = y+10*N+100*M                                                                                 
                                                                                                     
proc newG[N,M:static[int],T](x:T):G[N,M,T] = result.newG(x)                                          
                                                                                                     
var x:G[2,3,int]                                                                                     
x.newG(4)                                                                                            
var y = newG[2,3,int](4)

With v0.17.0

Hint: system [Processing]                                                                            
Hint: t_gentypeinst2 [Processing]                                                                    
t_gentypeinst2.nim(12, 14) Error: type expected

With devel

t_gentypeinst2.nim(12, 22) template/generic instantiation from here                                  
t_gentypeinst2.nim(8, 52) Error: type mismatch: got (G[system.int, system.int, system.int], int)     
but expected one of:                                                                                 
proc newG[N, M: static[int], T](x: var G[N, M, T]; y: T)                                             
proc newG[N, M: static[int], T](x: T): G[N, M, T]
cooldome added a commit that referenced this issue Nov 5, 2020
@Araq Araq closed this as completed in cdd459d Nov 6, 2020
narimiran pushed a commit that referenced this issue Nov 9, 2020
* close #9679

* close #7546

* close #9520

* close #6177

(cherry picked from commit cdd459d)
PMunch pushed a commit to PMunch/Nim that referenced this issue Jan 6, 2021
mildred pushed a commit to mildred/Nim that referenced this issue Jan 11, 2021
irdassis pushed a commit to irdassis/Nim that referenced this issue Mar 16, 2021
ardek66 pushed a commit to ardek66/Nim that referenced this issue Mar 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants