summaryrefslogtreecommitdiff
path: root/sources
diff options
context:
space:
mode:
authorpaltherr <paltherr@epfl.ch>2003-07-26 10:42:26 +0000
committerpaltherr <paltherr@epfl.ch>2003-07-26 10:42:26 +0000
commit60ec6920d93b13afdf557dab5f176603c65e1f6a (patch)
treeba7aaff624a21f93f452621f73a2723f6326ac0e /sources
parent056a15a7e819a7e28ca50ac8bed516634d3b395d (diff)
downloadscala-60ec6920d93b13afdf557dab5f176603c65e1f6a.tar.gz
scala-60ec6920d93b13afdf557dab5f176603c65e1f6a.tar.bz2
scala-60ec6920d93b13afdf557dab5f176603c65e1f6a.zip
- Added method cloneTypeNoSubst
Diffstat (limited to 'sources')
-rw-r--r--sources/scalac/symtab/Type.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/sources/scalac/symtab/Type.java b/sources/scalac/symtab/Type.java
index 7397eb3b53..8d0d83c500 100644
--- a/sources/scalac/symtab/Type.java
+++ b/sources/scalac/symtab/Type.java
@@ -1316,6 +1316,30 @@ public class Type implements Modifiers, Kinds, TypeTags, EntryTags {
}
}
+ /**
+ * Clones a type i.e. returns a new type where all symbols in
+ * MethodTypes and PolyTypes have been cloned. This method
+ * performs no substitution on the type of the cloned symbols.
+ * Typically, the type of those symbols will be fixed later by
+ * applying some Map.applyParams method to the returned type.
+ */
+ public Type cloneTypeNoSubst(SymbolCloner cloner) {
+ switch (this) {
+
+ case MethodType(Symbol[] vparams, Type result):
+ Symbol[] clones = cloner.cloneSymbols(vparams);
+ return Type.MethodType(clones, result.cloneTypeNoSubst(cloner));
+
+ case PolyType(Symbol[] tparams, Type result):
+ Symbol[] clones = cloner.cloneSymbols(tparams);
+ return Type.PolyType(clones, result.cloneTypeNoSubst(cloner));
+
+ default:
+ return this;
+ }
+ }
+
+
// Comparisons ------------------------------------------------------------------
/** Is this type a subtype of that type?