Giter VIP home page Giter VIP logo

Comments (2)

metagn avatar metagn commented on July 22, 2024

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:

  1. Remove the linkTo lines in readTypeParameter and just return an nkType node; this might lose information or break stuff
  2. To the and t.sym != nil condition in mapTypeToAstX, add and t.kind != tyTypeDesc; this seems too specific
  3. 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 like type T = X. This has the caveat of defining new behavior for getTypeInst that might be incompatible with old behavior. We could also combine the first option with and 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.

Clonkk avatar Clonkk commented on July 22, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.