-
Notifications
You must be signed in to change notification settings - Fork 570
compiler/prelude: Bug fix: specifying out of range index must panic #775
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
Changes from 1 commit
77256a9
b227c39
146c5f9
08b8e29
a0346cc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
Fixes #732
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -623,3 +623,15 @@ func TestTypeConversion(t *testing.T) { | |
t.Fail() | ||
} | ||
} | ||
|
||
func TestSliceOutOfRange(t *testing.T) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What do you think about moving this test and placing it next to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
defer func() { | ||
if err := recover(); err == nil || !strings.Contains(err.(error).Error(), "slice bounds out of range") { | ||
t.Fail() | ||
} | ||
}() | ||
|
||
a := make([]byte, 4096) | ||
b := a[8192:] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's no need to use numbers so large, the same issue would happen with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't have a strong opinion on it :-) Done. |
||
_ = b | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is missing a semicolon at the end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.