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

Error compiling nested template imports #508

Open
charlesstaats opened this issue Dec 27, 2024 · 0 comments
Open

Error compiling nested template imports #508

charlesstaats opened this issue Dec 27, 2024 · 0 comments
Labels

Comments

@charlesstaats
Copy link
Contributor

charlesstaats commented Dec 27, 2024

To duplicate, have the following 3 files:

test.asy:

struct A { }

access test2(T=A) as module;

test2.asy:

typedef import(T);

access test3(T=T) as module;

test3.asy:

typedef import(T);
T t = new T;

Compiling asy, and then running ./asy -noautoplain -d test, gives the following errors:

access test3(T=T) as module;
               ^
test2.asy: 3.16: static use of dynamic variable
T t = new T;
      ^
test3.asy: 3.7: static use of dynamic variable

Some notes:

  • If the line reads T t; instead of T t = new T;, then only the first error survives (at least on the master branch).
  • Running with -dir ./base instead of -noautoplain does not affect the result.
  • Without the nesting, there is no error. I cannot say for sure the error is related to templated imports; there might be a way to duplicate this behavior using nested structs. I have not really explored this avenue since I could not think of an approach that seemed promising to me, but my intuition in that area has proven faulty before.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant