noir-lang / noir

Noir is a domain specific language for zero knowledge proofs
https://noir-lang.org
Apache License 2.0
871 stars 188 forks source link

fix: allow using type aliases in struct patterns and constructors #5295

Open TomAFrench opened 3 months ago

TomAFrench commented 3 months ago

Description

Problem*

Resolves

Summary*

This PR adds behaviour to the elaborator such that when looking up a type fails, before throwing an error we instead look up a type alias using the same path. Should this resolve to a type alias, we then return the type to which this is an alias, otherwise we return the original error.

This allows us to use type aliases interchangeably with the associated type in struct patterns/constructors.

Additional Context

Documentation*

Check one:

PR Checklist*

TomAFrench commented 3 months ago

Looks like this PR causes panics if a type alias is used in a return type position.