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

Path Sum Bug #3

Open
TamDu-au opened this issue Feb 2, 2019 · 1 comment
Open

Path Sum Bug #3

TamDu-au opened this issue Feb 2, 2019 · 1 comment
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@TamDu-au
Copy link

TamDu-au commented Feb 2, 2019

There is a bug in the code:

for (i:= 0; i < forbiddens:Length(); i++){
if (N == forbiddens[i]){
return [-1];
}
}
if (N == 0){
return [0];
}
as := FindPath([a, b], N - a, forbiddens);
bs := FindPath([a, b], N - b, forbiddens);
if (as[0] == -1 && bs[0] == -1){
return [-1];
}
else if (as[0] != -1){
as = [a] ++ as;
return as;
}
else if (bs[0] != -1){
bs = [b] ++ bs;
return bs;
}
return [-1];

@voltrevo voltrevo added bug Something isn't working good first issue Good for newcomers labels Feb 4, 2019
@voltrevo
Copy link
Owner

voltrevo commented Feb 4, 2019

Well done 🎉

I didn't realize stack errors would get reported as compiler bugs 😉. Here's a simpler repro case:

func stackError() => stackError() + stackError();

return stackError();

This can be fixed by treating stack errors as a special case. It's still an error but not an internal error and it shouldn't ask the user to report it. If you want, you could do the fix yourself and submit a PR, take a look at this code:

https://github.com/voltrevo/vortex/blob/master/src/Compiler.ts#L40

Otherwise I'll get to it soon. Thanks again :-).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants