Error Caused by Migration to 2.10

29 views
Skip to first unread message

Seyed H. HAERI (Hossein)

unread,
Jul 7, 2012, 9:32:51 AM7/7/12
to scala-user
Dear all,

My following code which used to work under 2.9.2

case class LamExpWaiter(xs: Seq[Idn]) {
def apply[Exp <: LazyExp[_]](e: Exp): Exp#OpSemExp#Val =
apply_helper(e.asInstanceOf[Exp#OpSemExp])
def apply_helper[Exp <: LazyExp[Exp]](e: Exp): Exp#Val =
e.reify_lam(xs, e)
}

now gives me the following error regarding the "Exp#OpSemExp#Val" bit above:

Multiple markers at this line
- illegal type selection from volatile
type null
- illegal type selection from volatile
type null

Anyone can explain that? And, how can I get it fixed?

TIA,
--Hossein

--------------------------------------------------------------------------------------------------------------

Seyed H. HAERI (Hossein)

Research Assistant
Institute for Software Systems (STS)
Technical University of Hamburg (TUHH)
Hamburg, Germany

ACCU - Professionalism in programming - http://www.accu.org/
--------------------------------------------------------------------------------------------------------------

Dave

unread,
Jul 7, 2012, 10:30:27 AM7/7/12
to scala-user
remove '#Val' in
def apply[Exp <: LazyExp[_]](e: Exp): Exp#OpSemExp#Val =
like so
def apply[Exp <: LazyExp[_]](e: Exp): Exp#OpSemExp =

Then it works again.


On Jul 7, 3:32 pm, "Seyed H. HAERI (Hossein)"
<hossein.ha...@gmail.com> wrote:
> Dear all,
>
> My following code which used to work under 2.9.2
>
> case class LamExpWaiter(xs: Seq[Idn]) {
>   def apply[Exp <: LazyExp[_]](e: Exp): Exp#OpSemExp#Val =
>     apply_helper(e.asInstanceOf[Exp#OpSemExp])
>   def apply_helper[Exp <: LazyExp[Exp]](e: Exp): Exp#Val =
>     e.reify_lam(xs, e)
>
> }
>
> now gives me the following error regarding the "Exp#OpSemExp#Val" bit above:
>
> Multiple markers at this line
>         - illegal type selection from volatile
>          type null
>         - illegal type selection from volatile
>          type null
>
> Anyone can explain that? And, how can I get it fixed?
>
> TIA,
> --Hossein
>
> ---------------------------------------------------------------------------­-----------------------------------
>
> Seyed H. HAERI (Hossein)
>
> Research Assistant
> Institute for Software Systems (STS)
> Technical University of Hamburg (TUHH)
> Hamburg, Germany
>
> ACCU - Professionalism in programming -http://www.accu.org/
> ---------------------------------------------------------------------------­-----------------------------------

Dave

unread,
Jul 7, 2012, 10:34:41 AM7/7/12
to scala-user
The above change also works in 2.9.2.
> > ---------------------------------------------------------------------------­­------------------------------------ Hide quoted text -
>
> - Show quoted text -

Seyed H. HAERI (Hossein)

unread,
Jul 7, 2012, 11:31:12 AM7/7/12
to scala-user
Hi Dave,

> remove '#Val' in
> def apply[Exp <: LazyExp[_]](e: Exp): Exp#OpSemExp#Val =
> like so
> def apply[Exp <: LazyExp[_]](e: Exp): Exp#OpSemExp =

But, in my application, this is semantically wrong. The type I really
need to return is Exp#OpSemExp#Val. Why should that basically be
rejected? And, how can I can have the same effect now that 2.10
doesn't like it this way?

TIA,
--Hossein

--------------------------------------------------------------------------------------------------------------

Seyed H. HAERI (Hossein)

Research Assistant
Institute for Software Systems (STS)
Technical University of Hamburg (TUHH)
Hamburg, Germany

ACCU - Professionalism in programming - http://www.accu.org/
--------------------------------------------------------------------------------------------------------------

Dave

unread,
Jul 7, 2012, 12:58:13 PM7/7/12
to scala-user
I created an issue:
https://issues.scala-lang.org/browse/SI-6042


On 7 jul, 17:31, "Seyed H. HAERI (Hossein)" <hossein.ha...@gmail.com>
wrote:
> Hi Dave,
>
> > remove '#Val' in
> > def apply[Exp <: LazyExp[_]](e: Exp): Exp#OpSemExp#Val =
> > like so
> > def apply[Exp <: LazyExp[_]](e: Exp): Exp#OpSemExp =
>
> But, in my application, this is semantically wrong. The type I really
> need to return is Exp#OpSemExp#Val. Why should that basically be
> rejected? And, how can I can have the same effect now that 2.10
> doesn't like it this way?
>
> TIA,
> --Hossein
>
> ---------------------------------------------------------------------------­-----------------------------------
>
> Seyed H. HAERI (Hossein)
>
> Research Assistant
> Institute for Software Systems (STS)
> Technical University of Hamburg (TUHH)
> Hamburg, Germany
>
> ACCU - Professionalism in programming -http://www.accu.org/
> ---------------------------------------------------------------------------­-----------------------------------

Dave

unread,
Jul 7, 2012, 1:04:54 PM7/7/12
to scala-user
Maybe it is handy if you create an account in JIRA there if there are
questions, because they are not all on scala-user.
It communicates better.

On 7 jul, 17:31, "Seyed H. HAERI (Hossein)" <hossein.ha...@gmail.com>
wrote:
> Hi Dave,
>
> > remove '#Val' in
> > def apply[Exp <: LazyExp[_]](e: Exp): Exp#OpSemExp#Val =
> > like so
> > def apply[Exp <: LazyExp[_]](e: Exp): Exp#OpSemExp =
>
> But, in my application, this is semantically wrong. The type I really
> need to return is Exp#OpSemExp#Val. Why should that basically be
> rejected? And, how can I can have the same effect now that 2.10
> doesn't like it this way?
>
> TIA,
> --Hossein
>
> ---------------------------------------------------------------------------­-----------------------------------
>
> Seyed H. HAERI (Hossein)
>
> Research Assistant
> Institute for Software Systems (STS)
> Technical University of Hamburg (TUHH)
> Hamburg, Germany
>
> ACCU - Professionalism in programming -http://www.accu.org/
> ---------------------------------------------------------------------------­-----------------------------------

Dave

unread,
Jul 8, 2012, 10:28:05 AM7/8/12
to scala-user
If you have read the issue: it's not possible like that, maybe with
socalled 'dependent method types'.

The problem is in 'with This' in the line 'type OpSemExp <:
LazyExp[OpSemExp] with This' which has to do with existentials. So you
need to rewrite that. Don't know how, just heard the name today.

trait LazyExp[+This <: LazyExp[This]] extends Serializable with
Product {
this: This =>

type OpSemExp <: LazyExp[OpSemExp] with This
type Val <: AbsVal[This] with This
type App <: BaseApp[This] with This


protected val lr: LamReifierBase
def reify_lam[Thiz >: This](xs: Seq[Idn], e: Thiz): This#Val =
lr.reify_lam(xs, e.asInstanceOf[This])
def incarnator: BaseExp => This


def apply(x: Idn): App = incarnator(new BaseApp(this,
x)).asInstanceOf[App]
}


On 7 jul, 15:32, "Seyed H. HAERI (Hossein)" <hossein.ha...@gmail.com>
wrote:
> Dear all,
>
> My following code which used to work under 2.9.2
>
> case class LamExpWaiter(xs: Seq[Idn]) {
>   def apply[Exp <: LazyExp[_]](e: Exp): Exp#OpSemExp#Val =
>     apply_helper(e.asInstanceOf[Exp#OpSemExp])
>   def apply_helper[Exp <: LazyExp[Exp]](e: Exp): Exp#Val =
>     e.reify_lam(xs, e)
>
> }
>
> now gives me the following error regarding the "Exp#OpSemExp#Val" bit above:
>
> Multiple markers at this line
>         - illegal type selection from volatile
>          type null
>         - illegal type selection from volatile
>          type null
>
> Anyone can explain that? And, how can I get it fixed?
>
> TIA,
> --Hossein
>
> ---------------------------------------------------------------------------­-----------------------------------
>
> Seyed H. HAERI (Hossein)
>
> Research Assistant
> Institute for Software Systems (STS)
> Technical University of Hamburg (TUHH)
> Hamburg, Germany
>
> ACCU - Professionalism in programming -http://www.accu.org/
> ---------------------------------------------------------------------------­-----------------------------------

Dave

unread,
Jul 8, 2012, 10:34:45 AM7/8/12
to scala-user
'with This' is substituted with an existential skolem 'with _$1'

Seyed H. HAERI (Hossein)

unread,
Jul 8, 2012, 5:38:54 PM7/8/12
to scala-user
Hi Dave,

> 'with This' is substituted with an existential skolem 'with _$1'

Hmmm... Are you telling me I should replace

type OpSemExp <: LazyExp[OpSemExp] with This

with this one?

type OpSemExp <: LazyExp[OpSemExp] with _$1

TIA,
--Hossein

--------------------------------------------------------------------------------------------------------------

Seyed H. HAERI (Hossein)

Research Assistant
Institute for Software Systems (STS)
Technical University of Hamburg (TUHH)
Hamburg, Germany

ACCU - Professionalism in programming - http://www.accu.org/
--------------------------------------------------------------------------------------------------------------

Dave

unread,
Jul 8, 2012, 5:42:48 PM7/8/12
to scala-user
No that is already done. That is why it doesn't work.

On 8 jul, 23:38, "Seyed H. HAERI (Hossein)" <hossein.ha...@gmail.com>
wrote:
> Hi Dave,
>
> > 'with This' is substituted with an existential skolem 'with _$1'
>
> Hmmm... Are you telling me I should replace
>
> type OpSemExp <: LazyExp[OpSemExp] with This
>
> with this one?
>
> type OpSemExp <: LazyExp[OpSemExp] with _$1
>
> TIA,
> --Hossein
>
> ---------------------------------------------------------------------------­-----------------------------------
>
> Seyed H. HAERI (Hossein)
>
> Research Assistant
> Institute for Software Systems (STS)
> Technical University of Hamburg (TUHH)
> Hamburg, Germany
>
> ACCU - Professionalism in programming -http://www.accu.org/
> ---------------------------------------------------------------------------­-----------------------------------
Reply all
Reply to author
Forward
0 new messages