Skip to content

Conversation

jcosborn
Copy link
Contributor

@jcosborn jcosborn commented Dec 9, 2017

Fixed getTypeImpl for second part of #5788.
This changes the behavior so that it will recurse and give the final implementation for a recursively defined type.

@jcosborn jcosborn changed the title added test case for getTypeImpl modify getTypeImpl to reduce result to final implementation Dec 9, 2017
@Araq
Copy link
Member

Araq commented Dec 9, 2017

Let's hope this really doesn't require a helper Intset to detect cycles reliably.

@Araq Araq merged commit 96a5062 into nim-lang:devel Dec 9, 2017
@krux02
Copy link
Contributor

krux02 commented Jan 22, 2018

This commit broke the following case:

import macros

type
  ForeverForgottenSecretIdentifier[T] = object
    value: T

  SuperMysteryType[T] = object
    value: T

  A = SuperMysteryType[int]
  B = ForeverForgottenSecretIdentifier[int]
  C = ForeverForgottenSecretIdentifier[float32]
  D = SuperMysteryType[float32]

var
  a: A
  b: B
  c: C
  d: D

macro foobar(arg: typed): untyped =
  echo arg.getTypeInst.repr
  echo arg.getTypeImpl.repr

foobar(a)
foobar(b)
foobar(c)
foobar(d)

No matter what I do, ForeverForgottenSecretIdentifier and SuperMysteryType are not recoverable by the macros module anymore. Please undo this commit.

@jcosborn
Copy link
Contributor Author

This currently does what you want

| echo arg.getTypeInst.symbol.getImpl.repr

@krux02
Copy link
Contributor

krux02 commented Jan 22, 2018

@jcosborn thanks a lot. How am I supposed to know that?

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

Successfully merging this pull request may close these issues.

3 participants