TreeTypeMap
A map that applies three functions and a substitution together to a tree and makes sure they are coordinated so that the result is well-typed. The functions are
Value parameters
- newOwners
-
New owners, replacing previous owners.
- oldOwners
-
Previous owners. If a top-level local symbol in the mapped tree has one of these as an owner, the owner is replaced by the corresponding symbol in
newOwners
. - substFrom
-
The symbols that need to be substituted.
- substTo
-
The substitution targets. The reason the substitution is broken out from the rest of the type map is that all symbols have to be substituted at the same time. If we do not do this, we risk data races on named types. Example: Say we have
outer#1.inner#2
and we have two substitutions S1 = [outer#1 := outer#3], S2 = [inner#2 := inner#4] where hashtags precede symbol ids. If we do S1 first, we get outer#2.inner#3. If we then do S2 we get outer#2.inner#4. But that means that the named type outer#2.inner gets two different denotations in the same period. Hence, if -Yno-double-bindings is set, we would get a data race assertion error. - treeMap
-
A transformer that translates all encountered subtrees in prefix traversal orders
- typeMap
-
A function from Type to Type that gets applied to the type of every tree node and to all locally defined symbols, followed by the substitution [substFrom := substTo].
Attributes
- Graph
-
- Supertypes