We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
length_of_longest_substring = fn(input: str) -> int { letter_frequency = map[str, bool] start_index = 0 result = 0 from 0 to input.len(), i { if letter_frequency[input[i]] != nil { length = i - start_index if length > result { result = length } letter_frequency.clear() letter_frequency[input[i]] = true start_index = i continue } letter_frequency[input[i]] = true } return result } print length_of_longest_substring("pwwkew")
Finished dev [unoptimized + debuginfo] target(s) in 0.07s Running `target\debug\mscript.exe run .\examples\maps\leetcode_3.ms --verbose --no-pb` [ Trace ] INIT Virtual Stack at MODULE [ Debug ] pre-walk ".\\examples\\maps\\leetcode_3.ms" [ Debug ] registering new file ".\\examples\\maps\\leetcode_3.ms" (File { declarations: RefCell { value: [] }, location: ".\\examples\\maps\\leetcode_3.mmm", exports: RefCell { value: [] }, public_types: RefCell { value: {} }, compiled: CompilationLock(Cell { value: false }) }) -- Adding to: [] [ Trace ] Gen. mod ".\\examples\\maps\\leetcode_3.ms" -- skipping print_statement [ Info ] DONE preloading module .\examples\maps\leetcode_3.ms [ Info ] + mod "./examples/maps/leetcode_3.ms" ModuleType { exported_members: RefCell { value: [] }, public_types: RefCell { value: {} }, name: ".\\examples\\maps\\leetcode_3.ms" } [ Info ] + finished preload of ".\\examples\\maps\\leetcode_3.ms" [ Trace ] Virtual Stack PUSH: fn(???) -> Should(Native(Int)) [ Trace ] + input: str [ Trace ] + letter_frequency: map[str, bool] [ Trace ] + start_index: int [ Trace ] + result: int [ Trace ] Virtual Stack PUSH: Number Loop -> ParentShould(Native(Int)) [ Trace ] + i: int [ Trace ] Virtual Stack PUSH: If Block -> ParentShould(Native(Int)) [ Debug ] lhs:Native(Str(StrWrapper(None))) rhs:Native(Str(StrWrapper(None))) f:TypecheckFlags { executing_class: None, lhs_allow_optional_unwrap: false, force_rhs_to_be_unwrapped_lhs: false, signature_check: false, enforce_str_comptime_len_if_present: false } [ Trace ] + length: int [ Trace ] Virtual Stack PUSH: If Block -> ParentShould(Native(Int)) [ Trace ] + result: int [ Debug ] lhs:Native(Int) rhs:Native(Int) f:TypecheckFlags { executing_class: None, lhs_allow_optional_unwrap: false, force_rhs_to_be_unwrapped_lhs: false, signature_check: false, enforce_str_comptime_len_if_present: false } [ Trace ] Virtual Stack POP [ Debug ] lhs:Native(Str(StrWrapper(None))) rhs:Native(Str(StrWrapper(None))) f:TypecheckFlags { executing_class: None, lhs_allow_optional_unwrap: false, force_rhs_to_be_unwrapped_lhs: false, signature_check: false, enforce_str_comptime_len_if_present: false } [ Debug ] lhs:Native(Bool) rhs:Native(Bool) f:TypecheckFlags { executing_class: None, lhs_allow_optional_unwrap: true, force_rhs_to_be_unwrapped_lhs: false, signature_check: false, enforce_str_comptime_len_if_present: false } [ Trace ] + start_index: int [ Debug ] lhs:Native(Int) rhs:Native(Int) f:TypecheckFlags { executing_class: None, lhs_allow_optional_unwrap: false, force_rhs_to_be_unwrapped_lhs: false, signature_check: false, enforce_str_comptime_len_if_present: false } [ Trace ] Virtual Stack POP [ Debug ] lhs:Native(Str(StrWrapper(None))) rhs:Native(Str(StrWrapper(None))) f:TypecheckFlags { executing_class: None, lhs_allow_optional_unwrap: false, force_rhs_to_be_unwrapped_lhs: false, signature_check: false, enforce_str_comptime_len_if_present: false } [ Debug ] lhs:Native(Bool) rhs:Native(Bool) f:TypecheckFlags { executing_class: None, lhs_allow_optional_unwrap: true, force_rhs_to_be_unwrapped_lhs: false, signature_check: false, enforce_str_comptime_len_if_present: false } [ Trace ] Virtual Stack POP [ Debug ] lhs:Native(Int) rhs:Native(Int) f:TypecheckFlags { executing_class: None, lhs_allow_optional_unwrap: true, force_rhs_to_be_unwrapped_lhs: false, signature_check: false, enforce_str_comptime_len_if_present: false } [ Trace ] Virtual Stack POP [ Trace ] + length_of_longest_substring: fn(str) -> int [ Debug ] lhs:Native(Str(StrWrapper(None))) rhs:Native(Str(StrWrapper(Some(6)))) f:TypecheckFlags { executing_class: None, lhs_allow_optional_unwrap: false, force_rhs_to_be_unwrapped_lhs: false, signature_check: false, enforce_str_comptime_len_if_present: false } [ Trace ] Added compilation step: ".\\examples\\maps\\leetcode_3.ms" [ Debug ] [cc] FINAL COMPILATION LIST: [".\\examples\\maps\\leetcode_3.ms"] [ Info ] checking validation of `".\\examples\\maps\\leetcode_3.ms"`: completed [ Info ] [cc] @ .\examples\maps\leetcode_3.mmm [ Trace ] reg. -n--- 0 [ Trace ] reg. -n--- 1 [ Trace ] reg. -n--- 1 [ Trace ] reg. -n--- 2 [ Trace ] reg. -n--- 2 [ Trace ] reg. -n--- 3 [ Trace ] reg. F--em 0 [ Trace ] reg. -n--- 1 [ Trace ] reg. -n--- 2 [ Trace ] reg. -n--- 3 [ Trace ] reg. -n--- 3 [ Trace ] reg. -n--- 4 [ Trace ] reg. -n--- 5 [ Trace ] reg. -n--- 6 [ Trace ] reg. -n--- 6 [ Trace ] reg. -n--- 7 [ Trace ] reg. -n--- 8 [ Trace ] reg. F--e- 7 [ Trace ] reg. F--e- 6 [ Trace ] reg. F--e- 4 [ Trace ] reg. F--e- 3 [ Trace ] reg. -n--- 2 [ Trace ] reg. -n--- 1 [ Trace ] reg. -n--- 2 [ Trace ] reg. -n--- 2 [ Trace ] reg. -n--- 1 [ Trace ] reg. -n--- 2 [ Trace ] reg. -n--- 2 [ Trace ] reg. -n--- 1 [ Trace ] reg. -n--- 1 [ Trace ] reg. -n--- 2 [ Trace ] reg. -n--- 2 [ Trace ] reg. -n--- 3 [ Trace ] reg. F--em 0 [ Trace ] reg. -n--- 1 [ Trace ] reg. -n--- 2 [ Trace ] reg. -n--- 3 [ Trace ] reg. -n--- 4 [ Trace ] reg. -n--- 5 [ Trace ] reg. -n--- 5 [ Trace ] reg. -n--- 6 [ Trace ] reg. -n--- 7 [ Trace ] reg. F--e- 6 [ Trace ] reg. F--e- 5 [ Trace ] reg. F--e- 3 [ Trace ] reg. F--e- 2 [ Trace ] reg. -n--- 1 [ Trace ] reg. -n--- 1 [ Trace ] reg. -n--- 2 [ Trace ] reg. -n--- 3 [ Trace ] reg. -n--- 4 [ Trace ] reg. -n--- 5 [ Trace ] reg. -n--- 5 [ Trace ] reg. -n--- 6 [ Trace ] reg. -n--- 7 [ Trace ] reg. F--e- 6 [ Trace ] reg. F--e- 5 [ Trace ] reg. F--e- 3 [ Trace ] reg. F--e- 2 [ Trace ] reg. -n--- 1 [ Trace ] reg. -n--- 0 [ Trace ] reg. -n--- 1 [ Trace ] reg. -n--- 1 [ Trace ] reg. -G--m 2 [ Trace ] reg. -G--m 2 [ Trace ] reg. F--em 1 Compiled in 28.9036ms thread 'mscript-runtime' panicked at compiler\src\ast.rs:185:13: not an instruction: Continue(2) note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
This is valid code and is the solution to this Leetcode problem.
For some reason, the compiler isn't flagging the emitted continue signal and not updating it to a jmp instruction.
jmp
The text was updated successfully, but these errors were encountered:
fix #194 and add test case
f5bbbd5
This was caused by code that interpreted the end of an if statement scope as a loop terminator.
Sorry, something went wrong.
mrodz
Successfully merging a pull request may close this issue.
Snippet Responsible
Stack Trace of Error
Expected Behavior
This is valid code and is the solution to this Leetcode problem.
Any ideas where MScript breaks?
Brain Dump (Optional)
For some reason, the compiler isn't flagging the emitted continue signal and not updating it to a
jmp
instruction.The text was updated successfully, but these errors were encountered: