SI-5167 fsc, traits

33 views
Skip to first unread message

Jason Zaugg

unread,
Jun 2, 2012, 7:32:01 AM6/2/12
to scala-i...@googlegroups.com
I'm working on a fix for this issue, which involves a change to
AddInterfaces to create new symbols for params in the implementation
class method.

I've got a few questions:

https://issues.scala-lang.org/browse/SI-5167?focusedCommentId=57988&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-57988

-jason

Paul Phillips

unread,
Jun 2, 2012, 12:18:30 PM6/2/12
to scala-i...@googlegroups.com


On Sat, Jun 2, 2012 at 4:32 AM, Jason Zaugg <jza...@gmail.com> wrote:
I'm working on a fix for this issue, which involves a change to
AddInterfaces to create new symbols for params in the implementation
class method.

Why doesn't it clone the method symbol itself? That would clone the info, which would clone the parameters.  In fact it's hard to believe it doesn't already do that, so maybe I' missing something.

martin odersky

unread,
Jun 2, 2012, 12:33:23 PM6/2/12
to scala-i...@googlegroups.com
It does clone the method symbol. The problem seems to be that the cloned parameters do not make it into the tree. So the task would be to do a substitution from tree parameters to cloned symbol parameters in the impl method DefDef.

I do not think the second cloning in Jason's solution is correct.

Cheers

 - Martin

 

Som Snytt

unread,
Jun 2, 2012, 7:15:09 PM6/2/12
to scala-i...@googlegroups.com
To answer the first question, the "res" facility in partest fails correctly.

$ ls test/files/res/t5167/
t5167_1.scala  t5167_2.scala

apm@halyard /cygdrive/m/apm/projects/scala-snytt
$ cat test/files/res/t5167.res
t5167/t5167_1.scala
t5167/t5167_2.scala

apm@halyard /cygdrive/m/apm/projects/scala-snytt
$ cat test/files/res/t5167.check

nsc>
nsc>
nsc>

apm@halyard /cygdrive/m/apm/projects/scala-snytt
$ test/partest test/files/res/t5167.res
test/partest: line 37: cd: /cygdrive/m/apm/projects/scala-snytt/test
/cygdrive/m/apm/projects/scala-snytt/test/..: No such file or directory

Testing individual files
testing: [...]\files\res\t5167.res                                    [FAILED]
3,5c3,4
< nsc> t5167/t5167_2.scala:8: error: not enough arguments for method buggyMethod: (argWithDefault$1: String)Unit
<     sut.buggyMethod()
<                    ^
---
> nsc>
> nsc>

1 of 1 tests failed (elapsed time: 00:00:03)


On Sat, Jun 2, 2012 at 4:32 AM, Jason Zaugg <jza...@gmail.com> wrote:

Jason Zaugg

unread,
Jun 3, 2012, 5:09:17 AM6/3/12
to scala-i...@googlegroups.com
On Sat, Jun 2, 2012 at 6:33 PM, martin odersky <martin....@epfl.ch> wrote:

>> Why doesn't it clone the method symbol itself? That would clone the info,
>> which would clone the parameters.  In fact it's hard to believe it doesn't
>> already do that, so maybe I' missing something.
>>
> It does clone the method symbol. The problem seems to be that the cloned
> parameters do not make it into the tree. So the task would be to do a
> substitution from tree parameters to cloned symbol parameters in the impl
> method DefDef.
>
> I do not think the second cloning in Jason's solution is correct.

That makes sense. Is this the correct way to implement it?

https://github.com/retronym/scala/compare/ticket/5167

Thanks to Som, I've also added a test case.

-jason

Jason Zaugg

unread,
Jun 3, 2012, 6:43:04 AM6/3/12
to scala-i...@googlegroups.com
On Sun, Jun 3, 2012 at 11:09 AM, Jason Zaugg <jza...@gmail.com> wrote:
> That makes sense. Is this the correct way to implement it?
>
>  https://github.com/retronym/scala/compare/ticket/5167

Moved to a pull request:

https://github.com/scala/scala/pull/659

-jason
Reply all
Reply to author
Forward
0 new messages