You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Remove subtyping for () from node graph type system (#2418)
* Remove subtyping for () from node graph type system
* Remove special-case in DynAnyNode for downcasting to ()
* Correct input type for CreateGpuSurfaceNode
* Remove unncessary imports
---------
Co-authored-by: Dennis Kobert <dennis@kobert.dev>
Co-authored-by: Keavon Chambers <keavon@keavon.com>
Co-authored-by: hypercube <0hypercube@gmail.com>
// Loose comparison of function types, where loose means that functions are considered on a "greater than or equal to" basis of its function type's generality.
700
+
// Direct comparison of two function types.
701
+
// Note: in the presence of subtyping, functions are considered on a "greater than or equal to" basis of its function type's generality.
701
702
// That means we compare their types with a contravariant relationship, which means that a more general type signature may be substituted for a more specific type signature.
702
703
// For example, we allow `T -> V` to be substituted with `T' -> V` or `() -> V` where T' and () are more specific than T.
703
704
// This allows us to supply anything to a function that is satisfied with `()`.
@@ -706,8 +707,9 @@ impl TypingContext {
706
707
// - `V >= V' ⇒ (T -> V) >= (T -> V')` (functions are covariant in their output types)
707
708
// While these two relations aren't a truth about the universe, they are a design decision that we are employing in our language design that is also common in other languages.
708
709
// For example, Rust implements these same relations as it describes here: <https://doc.rust-lang.org/nomicon/subtyping.html>
710
+
// Graphite doesn't have subtyping currently, but it used to have it, and may do so again, so we make sure to compare types in this way to make things easier.
709
711
// More details explained here: <https://github.com/GraphiteEditor/Graphite/issues/1741>
0 commit comments