Re: Error "Outer Function Context is Needed" when class declared in unittest

2024-01-25 Thread Kagamin via Digitalmars-d-learn
Looks like the context is currently passed for nested functions, not for nested classes.

Re: Error "Outer Function Context is Needed" when class declared in unittest

2024-01-21 Thread Jim Balter via Digitalmars-d-learn
On Thursday, 5 January 2023 at 13:47:24 UTC, Adam D Ruppe wrote: On Thursday, 5 January 2023 at 13:27:23 UTC, Vijay Nayar wrote: Why is this error only found when declaring a class in the unittest? A unittest is just a special function, it can run code and have local variables. classes and

Re: Error "Outer Function Context is Needed" when class declared in unittest

2023-01-05 Thread Vijay Nayar via Digitalmars-d-learn
On Thursday, 5 January 2023 at 16:41:32 UTC, Adam D Ruppe wrote: On Thursday, 5 January 2023 at 16:38:49 UTC, Vijay Nayar wrote: Does that class inherit the scope of the function it is inside, similar to how an inner class does with an outer class? yup. They can see the local variables from

Re: Error "Outer Function Context is Needed" when class declared in unittest

2023-01-05 Thread Adam D Ruppe via Digitalmars-d-learn
On Thursday, 5 January 2023 at 16:38:49 UTC, Vijay Nayar wrote: Does that class inherit the scope of the function it is inside, similar to how an inner class does with an outer class? yup. They can see the local variables from the function.

Re: Error "Outer Function Context is Needed" when class declared in unittest

2023-01-05 Thread Vijay Nayar via Digitalmars-d-learn
On Thursday, 5 January 2023 at 13:47:24 UTC, Adam D Ruppe wrote: On Thursday, 5 January 2023 at 13:27:23 UTC, Vijay Nayar wrote: Why is this error only found when declaring a class in the unittest? A unittest is just a special function, it can run code and have local variables. classes and

Re: Error "Outer Function Context is Needed" when class declared in unittest

2023-01-05 Thread Adam D Ruppe via Digitalmars-d-learn
On Thursday, 5 January 2023 at 13:27:23 UTC, Vijay Nayar wrote: Why is this error only found when declaring a class in the unittest? A unittest is just a special function, it can run code and have local variables. classes and structs declared inside it have access to those local contexts,