Comments (2)
The type of Y[X].T
is typedesc[X]
, but it also stores the info of the symbol T
of the original unresolved generic param and this is what getTypeInst
gives. This symbol is given to the type here and here (with linkTo
).
From what I understand this shouldn't happen, a typedesc
type should not have a bound symbol unless it is literally typedesc
. But I don't know which makes the most sense to do:
- Remove the
linkTo
lines inreadTypeParameter
and just return annkType
node; this might lose information or break stuff - To the
and t.sym != nil
condition inmapTypeToAstX
, addand t.kind != tyTypeDesc
; this seems too specific - To fix #23564 as well we can add
and t.kind notin {tyTypeDesc, tyAlias}
instead. That is, the only types where an "instantiation symbol" is ignored in favor of the implementation become typedescs or primitive alias types liketype T = X
. This has the caveat of defining new behavior forgetTypeInst
that might be incompatible with old behavior. We could also combine the first option withand t.kind != tyAlias
instead but this seems more independent of compiler internals.
Edit: Actually I think hasCustomPragma
should deal with tyAlias
, getTypeInst
shouldn't skip it.
from nim.
I don't understand the purpose of taking the generic T before hasCustomPragma
echo Y[X].T.hasCustomPragma(p) # why do you need to work on the typedesc ?
echo Y[X].t.hasCustomPragma(p) # Works
from nim.
Related Issues (20)
- Using waitForExit with timeout from multiple threads simultaneously hangs HOT 1
- Cyclic proc calls causes infinite memory usage HOT 12
- Custom iterator is not found if used in template function, if used from a third file HOT 1
- bisecting 2.2.0 rc1 HOT 17
- cursor optimizer doesn't understand that distinct cstring can be an owning type
- Cross compilation with mingw for cpu=i386 from linux/macos fails with time_t bug HOT 2
- Type error when sink added to parameters HOT 2
- Nim `devel` nightly `i386` build failing HOT 1
- `koch pdf` produces a warning about unknown substitution 'nimversion'
- `nim gendepend` does not work with var-less destructors
- When JS, operations on pointer casted from ref object raises Runtime-Errors
- Regression - cannot instantiate Maybe generic arguments are missing HOT 5
- Identifier expected or compiler segfault with templates over generic type in type section HOT 3
- Nested generic/static parameter: undeclared identifier in typesections HOT 2
- 2.2.0 rc1 regression with cdecl functions
- Warnings missing when compiling the same file twice HOT 4
- `genericsOpenSym` not working when additional generally non-matching symbol with same name is present HOT 1
- nimsuggest crashes when using `--mm:arc/orc` and if an object that contains `string` or `seq` is constructed
- ARC hooks missing when sinking generic typeclass HOT 3
- Generic concepts not compatible with openarray HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nim.