FuelLabs / sway

🌴 Empowering everyone to build reliable and efficient smart contracts.
https://docs.fuel.network/docs/sway/
Apache License 2.0
62.64k stars 5.36k forks source link

Add a declaration engine #1692

Closed mohammadfawaz closed 2 years ago

mohammadfawaz commented 2 years ago

The declaration engine allows the compiler add a layer of separation between AST nodes and declarations.

The goal of adding the declaration engine is to:

  1. unlock trait constraints
  2. stop inlining function bodies during type checking
  3. perform optimizations during monormorphization

See the relevant RFC here: https://github.com/FuelLabs/sway-rfcs/pull/11

The prototype can be used to guide implementation: https://github.com/emilyaherbert/declaration-engine-and-collection-context-demo/tree/master/de

emilyaherbert commented 2 years ago

This is now done! 🥳

I've moved where we are tracking the monomorphization cache into this issue: #1819

mohammadfawaz commented 2 years ago

This is now complete, hopefully for real this time 🥳