PolymerLabs / arcs

Arcs
BSD 3-Clause "New" or "Revised" License
58 stars 35 forks source link

Simplify type checking in recipes #2705

Open shans opened 5 years ago

shans commented 5 years ago

At the moment, type specifications from ParticleSpecs are eagerly copied into HandleConnections when the HandleConnection is created. Because of type variables, this means that there can be shared references to variable info objects from the ParticleSpec and from the HandleConnection.

This in turn means that when cloning ParticleSpec objects as part of a recipe clone, we need to clone them with the same context as we cloned the recipe Particle with. Previously this wasn't a problem because all HandleConnections were eagerly created and we could ignore the ParticleSpec at that point.

What we should do instead is always clone the ParticleSpec types into the relevant handles immediately before type-checking. This will also allow us to get rid of the type/rawType confusion, and we can probably do something similar for storage types.

shans commented 5 years ago

related to #2644

Cypher1 commented 5 years ago

In addition it would be good to remove our dependence on null in the type checker, which would help with adding types to the file (as null has type any).