Scala implementation of space logic
Abstract sealed types, or-types, Boolean and Java enums can be decomposed
Decompose a type into subspaces -- assume the type can be decomposed
Checks if it's possible to create a trait/class which is a subtype of
- doesn't handle member collisions (will not declare a type unimplementable because of one)
- expects that neither Any nor Object reach it (this is currently true due to both isSubType and and/or type simplification)
tp1 to be a subtype of
Return the instantiated type if type parameters and this type
tp1 can be instantiated such that
tp1 <:< tp2.
Otherwise, return NoType.
Return the space that represents the pattern
Space of the pattern: unapplySeq(a, b, c: _*)
Refine child based on parent
In child class definition, we have:
class Child[Ts] extends path.Parent[Us] with Es object Child extends path.Parent[Us] with Es val child = new path.Parent[Us] with Es // enum values
Given a parent type
parent and a child symbol
child, we infer the prefix
and type parameters for the child:
prefix.child[Vs] <:< parent
Vs are fresh type variables and
prefix is the symbol prefix with all
non-module and non-package
ThisType replaced by fresh type variables.
If the subtyping is true, the instantiated type
NoType is returned.
Whether the counterexample is satisfiable. The space is flattened and non-empty.
Whehter counter-examples should be further checked? True for GADTs.
Show friendly type name with current scope in mind
E.g. C.this.B --> B if current owner is C C.this.x.T --> x.T if current owner is C X[T] --> X C --> C if current owner is C !!!