I’m stuck on Stage #MF6. When I copy-paste the the test case and run it locally, things are fine. But when I try to run it remotely, it’s hitting an assert I wrote.
I’ve tried to turn on the debug logging but it hasn’t shown anything useful.
Here are my logs (remote):
[tester::#MF6] [test-2] Writing contents to ./test.lox:
[tester::#MF6] [test-2.lox] {
[tester::#MF6] [test-2.lox] class A {}
[tester::#MF6] [test-2.lox]
[tester::#MF6] [test-2.lox] // B is a subclass of A
[tester::#MF6] [test-2.lox] class B < A {}
[tester::#MF6] [test-2.lox]
[tester::#MF6] [test-2.lox] // C is also a subclass of A
[tester::#MF6] [test-2.lox] class C < A {}
[tester::#MF6] [test-2.lox]
[tester::#MF6] [test-2.lox] print A();
[tester::#MF6] [test-2.lox] print B();
[tester::#MF6] [test-2.lox] print C();
[tester::#MF6] [test-2.lox] }
[tester::#MF6] [test-2] $ ./your_program.sh run test.lox
[your_program] [Compile] Already a variable B+init in scope
(that last line is my assert)
Here are my logs (local):
codecrafters-interpreter-cpp % cat test.lox
{
class A {}
// B is a subclass of A
class B < A {}
// C is also a subclass of A
class C < A {}
print A();
print B();
print C();
}
codecrafters-interpreter-cpp % ./your_program.sh run test.lox
-- Configuring done (0.1s)
-- Generating done (0.0s)
-- Build files have been written to: codecrafters-interpreter-cpp/build
[100%] Built target interpreter
A instance
B instance
C instance
codecrafters-interpreter-cpp % echo $?
0
I doubt my code is correct to pass this stage, but this is the first time I’ve not been able to reporduce an issue locally, so I thought I would raise it. I wouldn’t be surprised if it’s some silly mistake on my end ![]()
