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

Type -> Type -> template fails to compile #20367

Closed
rotu opened this issue Sep 16, 2022 · 1 comment · Fixed by #24525
Closed

Type -> Type -> template fails to compile #20367

rotu opened this issue Sep 16, 2022 · 1 comment · Fixed by #24525

Comments

@rotu
Copy link
Contributor

rotu commented Sep 16, 2022

What happened?

Defining a type via template by means of an intermediate generic type fails. This occurs whether the generic parameter is a type or a static value.

template someTemp(T:type):typedesc = T
type
    Foo[T2:type] = someTemp(T2)
    Bar[T1:type] = Foo[T1]
var u:Foo[float] # works
var v:Bar[float] # Error: invalid type: 'None' in this context: 'Bar[system.float]' for var
template someOtherTemp(p:static[int]):untyped = array[p,int]
type
    Foo2[n:static[int]] = someOtherTemp(n)
    Bar2[m:static[int]] = Foo2[m]
var x:Foo2[1] # works
var y:Bar2[1] # Error: undeclared identifier: 'n'

Nim Version

Nim Compiler Version 1.7.1 [MacOSX: amd64]
Compiled at 2022-09-15
Copyright (c) 2006-2022 by Andreas Rumpf

git hash: 79afee8
active boot switches: -d:release

Current Standard Output Logs

No response

Expected Standard Output Logs

No response

Possible Solution

No response

Additional Information

No response

@metagn
Copy link
Collaborator

metagn commented Oct 14, 2024

Second example now works, first example works if : type is removed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants