diff options
author | Paul Phillips <paulp@improving.org> | 2012-06-19 09:45:49 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-06-19 09:52:42 -0700 |
commit | 47fad25adba895e8b27aee479373ea364dd316dd (patch) | |
tree | fa23f2f7675bc48b3d89a70e1996a9c079783ca7 /src | |
parent | 32d42b1264bd52578957abffe312a128ac23122b (diff) | |
download | scala-47fad25adba895e8b27aee479373ea364dd316dd.tar.gz scala-47fad25adba895e8b27aee479373ea364dd316dd.tar.bz2 scala-47fad25adba895e8b27aee479373ea364dd316dd.zip |
Fix for SI-5953, extension methods crasher.
As usual, .tpe -> .tpeHK. As a side note following an old theme,
if symbols of type parameters knew that they were symbols of type
parameters, they could call tpeHK themselves rather than every call
site having to do it. It's the operation which injects dummies which
should require explicit programmer action, not the operation which
faithfully reproduces the unapplied type. Were it that way, errors could
be caught much more quickly via ill-kindedness.
Seems like an improvement over lurking compiler crashes at every call
to tparam.tpe.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/ExtensionMethods.scala | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/ExtensionMethods.scala b/src/compiler/scala/tools/nsc/transform/ExtensionMethods.scala index 1c97eaad8b..5f66cadbc9 100644 --- a/src/compiler/scala/tools/nsc/transform/ExtensionMethods.scala +++ b/src/compiler/scala/tools/nsc/transform/ExtensionMethods.scala @@ -107,7 +107,7 @@ abstract class ExtensionMethods extends Transform with TypingTransformers { def extensionMethInfo(extensionMeth: Symbol, origInfo: Type, clazz: Symbol): Type = { var newTypeParams = cloneSymbolsAtOwner(clazz.typeParams, extensionMeth) - val thisParamType = appliedType(clazz.typeConstructor, newTypeParams map (_.tpe)) + val thisParamType = appliedType(clazz.typeConstructor, newTypeParams map (_.tpeHK)) val thisParam = extensionMeth.newValueParameter(nme.SELF, extensionMeth.pos) setInfo thisParamType def transform(clonedType: Type): Type = clonedType match { case MethodType(params, restpe) => @@ -159,7 +159,7 @@ abstract class ExtensionMethods extends Transform with TypingTransformers { .changeOwner((origMeth, extensionMeth)) extensionDefs(companion) += atPos(tree.pos) { DefDef(extensionMeth, extensionBody) } val extensionCallPrefix = Apply( - gen.mkTypeApply(gen.mkAttributedRef(companion), extensionMeth, origTpeParams map (_.tpe)), + gen.mkTypeApply(gen.mkAttributedRef(companion), extensionMeth, origTpeParams map (_.tpeHK)), List(This(currentOwner))) val extensionCall = atOwner(origMeth) { localTyper.typedPos(rhs.pos) { |