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

GetOffset crash on pattern match #807

Closed
omegablitz opened this issue Dec 3, 2019 · 1 comment · Fixed by #809
Closed

GetOffset crash on pattern match #807

omegablitz opened this issue Dec 3, 2019 · 1 comment · Fixed by #809

Comments

@omegablitz
Copy link
Contributor

The following code crashes with a GetOffset on 5 error:

let option @ { ? } = import! std.option

let crash opt =
    match opt with
    | None -> 0
    | Some -> option.unwrap opt

crash (Some 5)

(I realize that I should be unpacking instead of using option.unwrap, but this is the smallest reproduction I could find)

I haven't looked in detail into where this error originates, but I suspect it's because it's being matched into Some instead of Some _. If this is the case, the error should be caught at typecheck time.

@omegablitz omegablitz changed the title GetOffset crash GetOffset crash on matching Dec 3, 2019
@omegablitz omegablitz changed the title GetOffset crash on matching GetOffset crash on pattern match Dec 3, 2019
@Marwes
Copy link
Member

Marwes commented Dec 3, 2019

Thanks for the report! The typechecker only checked that there weren't to many argument specified.

bors bot added a commit that referenced this issue Dec 3, 2019
809: fix(check): Reject programs which misspecifies the number of patterns r=Marwes a=Marwes

... in a constructor

Fixes #807

Co-authored-by: Markus Westerlind <marwes91@gmail.com>
@bors bors bot closed this as completed in 248387d Dec 3, 2019
@bors bors bot closed this as completed in #809 Dec 3, 2019
Marwes added a commit to Marwes/gluon that referenced this issue Apr 14, 2020
<a name="v0.14.0"></a>
## v0.14.0 (2020-04-14)

#### Bug Fixes

*   Rework how hanging lambda/parens are handled ([732f09f](gluon-lang@732f09f))
*   Accept filenames that start with `.`/`..` as modules ([01e450b](gluon-lang@01e450b))
*   Don't deadlock when collecting and cloning a thread concurrently ([5886f59](gluon-lang@5886f59))
* **check:**  Reject programs which misspecifies the number of patterns ([248387d](gluon-lang@248387d), closes [gluon-lang#807](gluon-lang#807))
* **doc:**  Correct the style.css path ([4e629ab](gluon-lang@4e629ab))
* **format:**  Improve tuple multiline formatting ([5122fe3](gluon-lang@5122fe3))

#### Features

*   Add AstClone to clone arena allocated ASTs ([3ee7bd2](gluon-lang@3ee7bd2))
*   Compile modules in parallel using salsa-async ([e0ab181](gluon-lang@e0ab181))
*   Compile modules in parallel ([57fca16](gluon-lang@57fca16))
*   Add Function::call_any ([2c06104](gluon-lang@2c06104))
*   Export Array from the prelude ([16eb345](gluon-lang@16eb345))
*   Allow serde_json::Value to be marshalled to std.json.Value ([aabdec8](gluon-lang@aabdec8))
* **check:**
  *  Avoid propagating errors on lift_io! misuse ([3dbabe5](gluon-lang@3dbabe5))
  *  Avoid generating more errors from a type that could not be imported ([752e2bc](gluon-lang@752e2bc))

#### Performance

*   Avoid some unnecessary allocations ([089bae4](gluon-lang@089bae4))
*   Shrink the size of Pattern ([75fb884](gluon-lang@75fb884))
*   Avoid hashing symbols twice ([0cfb52c](gluon-lang@0cfb52c))
*   Allocate all temporaries into the same Vec ([af945c4](gluon-lang@af945c4))
* **compiler:**  Hoist a remove_alias call out from match alternatives ([c13172e](gluon-lang@c13172e))
bors bot added a commit that referenced this issue Apr 14, 2020
826: Version 0.14.0 r=Marwes a=Marwes

## v0.14.0 (2020-04-14)

#### Bug Fixes

*   Rework how hanging lambda/parens are handled ([732f09f](732f09f))
*   Accept filenames that start with `.`/`..` as modules ([01e450b](01e450b))
*   Don't deadlock when collecting and cloning a thread concurrently ([5886f59](5886f59))
* **check:**  Reject programs which misspecifies the number of patterns ([248387d](248387d), closes [#807](#807))
* **doc:**  Correct the style.css path ([4e629ab](4e629ab))
* **format:**  Improve tuple multiline formatting ([5122fe3](5122fe3))

#### Features

*   Add AstClone to clone arena allocated ASTs ([3ee7bd2](3ee7bd2))
*   Compile modules in parallel using salsa-async ([e0ab181](e0ab181))
*   Compile modules in parallel ([57fca16](57fca16))
*   Add Function::call_any ([2c06104](2c06104))
*   Export Array from the prelude ([16eb345](16eb345))
*   Allow serde_json::Value to be marshalled to std.json.Value ([aabdec8](aabdec8))
* **check:**
  *  Avoid propagating errors on lift_io! misuse ([3dbabe5](3dbabe5))
  *  Avoid generating more errors from a type that could not be imported ([752e2bc](752e2bc))

#### Performance

*   Avoid some unnecessary allocations ([089bae4](089bae4))
*   Shrink the size of Pattern ([75fb884](75fb884))
*   Avoid hashing symbols twice ([0cfb52c](0cfb52c))
*   Allocate all temporaries into the same Vec ([af945c4](af945c4))
* **compiler:**  Hoist a remove_alias call out from match alternatives ([c13172e](c13172e))

Co-authored-by: Markus Westerlind <marwes91@gmail.com>
Marwes added a commit to Marwes/gluon that referenced this issue Apr 14, 2020
<a name="v0.14.0"></a>
## v0.14.0 (2020-04-14)

#### Bug Fixes

*   Rework how hanging lambda/parens are handled ([732f09f](gluon-lang@732f09f))
*   Accept filenames that start with `.`/`..` as modules ([01e450b](gluon-lang@01e450b))
*   Don't deadlock when collecting and cloning a thread concurrently ([5886f59](gluon-lang@5886f59))
* **check:**  Reject programs which misspecifies the number of patterns ([248387d](gluon-lang@248387d), closes [gluon-lang#807](gluon-lang#807))
* **doc:**  Correct the style.css path ([4e629ab](gluon-lang@4e629ab))
* **format:**  Improve tuple multiline formatting ([5122fe3](gluon-lang@5122fe3))

#### Features

*   Add AstClone to clone arena allocated ASTs ([3ee7bd2](gluon-lang@3ee7bd2))
*   Compile modules in parallel using salsa-async ([e0ab181](gluon-lang@e0ab181))
*   Compile modules in parallel ([57fca16](gluon-lang@57fca16))
*   Add Function::call_any ([2c06104](gluon-lang@2c06104))
*   Export Array from the prelude ([16eb345](gluon-lang@16eb345))
*   Allow serde_json::Value to be marshalled to std.json.Value ([aabdec8](gluon-lang@aabdec8))
* **check:**
  *  Avoid propagating errors on lift_io! misuse ([3dbabe5](gluon-lang@3dbabe5))
  *  Avoid generating more errors from a type that could not be imported ([752e2bc](gluon-lang@752e2bc))

#### Performance

*   Avoid some unnecessary allocations ([089bae4](gluon-lang@089bae4))
*   Shrink the size of Pattern ([75fb884](gluon-lang@75fb884))
*   Avoid hashing symbols twice ([0cfb52c](gluon-lang@0cfb52c))
*   Allocate all temporaries into the same Vec ([af945c4](gluon-lang@af945c4))
* **compiler:**  Hoist a remove_alias call out from match alternatives ([c13172e](gluon-lang@c13172e))
bors bot added a commit that referenced this issue Apr 14, 2020
826: Version 0.14.0 r=Marwes a=Marwes

## v0.14.0 (2020-04-14)

#### Bug Fixes

*   Rework how hanging lambda/parens are handled ([732f09f](732f09f))
*   Accept filenames that start with `.`/`..` as modules ([01e450b](01e450b))
*   Don't deadlock when collecting and cloning a thread concurrently ([5886f59](5886f59))
* **check:**  Reject programs which misspecifies the number of patterns ([248387d](248387d), closes [#807](#807))
* **doc:**  Correct the style.css path ([4e629ab](4e629ab))
* **format:**  Improve tuple multiline formatting ([5122fe3](5122fe3))

#### Features

*   Add AstClone to clone arena allocated ASTs ([3ee7bd2](3ee7bd2))
*   Compile modules in parallel using salsa-async ([e0ab181](e0ab181))
*   Compile modules in parallel ([57fca16](57fca16))
*   Add Function::call_any ([2c06104](2c06104))
*   Export Array from the prelude ([16eb345](16eb345))
*   Allow serde_json::Value to be marshalled to std.json.Value ([aabdec8](aabdec8))
* **check:**
  *  Avoid propagating errors on lift_io! misuse ([3dbabe5](3dbabe5))
  *  Avoid generating more errors from a type that could not be imported ([752e2bc](752e2bc))

#### Performance

*   Avoid some unnecessary allocations ([089bae4](089bae4))
*   Shrink the size of Pattern ([75fb884](75fb884))
*   Avoid hashing symbols twice ([0cfb52c](0cfb52c))
*   Allocate all temporaries into the same Vec ([af945c4](af945c4))
* **compiler:**  Hoist a remove_alias call out from match alternatives ([c13172e](c13172e))

Co-authored-by: Markus Westerlind <marwes91@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants