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

Type aliasing not working for tuple structs #363

Open
jonatcln opened this issue Jan 29, 2022 · 1 comment
Open

Type aliasing not working for tuple structs #363

jonatcln opened this issue Jan 29, 2022 · 1 comment
Assignees
Labels
exp: high Achievable by investing significant time and effort, potentially through collaboration type: fix Bug fix or report

Comments

@jonatcln
Copy link
Contributor

jonatcln commented Jan 29, 2022

Type aliasing doesn't seem to work for tuple struct types.

Consider the example below. When building this code without the last line of main(), the compiler gives no errors (as expected). However, when also instantiating a PointTupleAlias (last line of main()), an error: cannot find value `PointTupleAlias` in this scope is produced (full error underneath the example). Expected behavior would be to compile without errors.

Example:

struct PointTuple(i32, i32);
struct PointRecord { x: i32, y: i32 }

type PointTupleAlias = PointTuple;
type PointRecordAlias = PointRecord;

pub fn main() {
    let pr = PointRecord { x: 2, y: 3 };
    let pt = PointTuple(2, 3);
    let pr2 = PointRecordAlias { x: 2, y: 3 };
    let pt2 = PointTupleAlias(2, 3);    // error: cannot find value `PointTupleAlias` in this scope
}

Compile error:

error: cannot find value `PointTupleAlias` in this scope
  --> mod.mun:11:15
   |
11 |     let pt2 = PointTupleAlias(2, 3);
   |               ^^^^^^^^^^^^^^^ not found in this scope
   |

Edit: tested using both Mun 0.3.0 and the main branch

@baszalmstra
Copy link
Collaborator

Thanks for the report! I will look into this! :)

@baszalmstra baszalmstra self-assigned this Jan 30, 2022
@Wodann Wodann added type: fix Bug fix or report exp: high Achievable by investing significant time and effort, potentially through collaboration labels Jan 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exp: high Achievable by investing significant time and effort, potentially through collaboration type: fix Bug fix or report
Projects
None yet
Development

No branches or pull requests

3 participants