Skip to content

Fix sequence matching. #669

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jun 19, 2015
Merged

Fix sequence matching. #669

merged 5 commits into from
Jun 19, 2015

Conversation

DarkDimius
Copy link
Contributor

@odersky please review.
Fixes #660

@DarkDimius
Copy link
Contributor Author

Unintentionally fixed #656.

Even if an explicit outer accessor was a method, it got a TermRef as type.
@DarkDimius
Copy link
Contributor Author

I believe we have some issue with partest here. I can locally reproduce partest failure on the local machine. Though I cannot reproduce it if I directly use class files that partest generated:

If I go to the directory with class files compiled by partest /Users/dark/workspace/dotty/tests/partest-generated/run/t5629b-run.obj

and execute the very same command that partest did:

java \
>    -classpath \
>    /Users/dark/workspace/dotty/tests/partest-generated/run/t5629b-run.obj:/Users/dark/workspace/dotty/target/scala-2.11/dotty_2.11-0.1-SNAPSHOT.jar:/Users/dark/.ivy2/cache/me.d-d/scala-compiler/jars/scala-compiler-2.11.5-20150506-175515-8fc7635b56.jar:/Users/dark/.ivy2/cache/org.scala-lang/scala-reflect/jars/scala-reflect-2.11.5.jar:/Users/dark/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.11.5.jar \
>    -Dfile.encoding=UTF-8 \
>    -Djava.library.path=/Users/dark/workspace/dotty/tests/partest-generated/run \
>    -Dpartest.output=/Users/dark/workspace/dotty/tests/partest-generated/run/t5629b-run.obj \
>    -Dpartest.lib=/Users/dark/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.11.5.jar \
>    -Dpartest.reflect=/Users/dark/.ivy2/cache/org.scala-lang/scala-reflect/jars/scala-reflect-2.11.5.jar \
>    -Dpartest.comp=/Users/dark/workspace/dotty/target/scala-2.11/dotty_2.11-0.1-SNAPSHOT.jar \
>    -Dpartest.cwd=/Users/dark/workspace/dotty/tests/partest-generated/run \
>    -Dpartest.test-path=/Users/dark/workspace/dotty/tests/partest-generated/run/t5629b.scala \
>    -Dpartest.testname=t5629b \
>    -Djavacmd=java \
>    -Djavaccmd=javac \
>    -Duser.language=en \
>    -Duser.country=US \
>    scala.tools.nsc.MainGenericRunner \
>    -usejavacp \
>    Test

The test runs correctly.

If an inner class has proxy fields, we missed so far the assignment sfrom
the proxy parameters in the primary constructor of the class to the proxy
fields.

Test case tries several variations of this.
@odersky
Copy link
Contributor

odersky commented Jun 19, 2015

When I try manually it I get the same error as partest.

They used to be discoverable using repeatedType, but ElimRepeated eliminates it.
Instead I'm using internal synthetic Typed nodes name, similar to how it's done for non-star Wildcards.
This makes handling Wildcards and Wildacard_Star more symmetric in patmat.
Call drop method directly if class derives from sequence.
I do not understand how callRuntime works in scalac. Calling this method requires implicit search.
Was also fixed in this PR.
@@ -136,7 +136,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans
def callDirect = tgt.select(nme.drop).appliedTo(Literal(Constant(n)))
def callRuntime = ref(defn.traversableDropMethod).appliedTo(tgt, Literal(Constant(n)))

def needsRuntime = tgt.tpe derivesFrom defn.SeqClass /*typeOfMemberNamedDrop(tgt.tpe) == NoType*/
def needsRuntime = !(tgt.tpe derivesFrom defn.SeqClass) /*typeOfMemberNamedDrop(tgt.tpe) == NoType*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant parens around the expression.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I was myopic here. All's good.

@odersky
Copy link
Contributor

odersky commented Jun 19, 2015

Otherwise LGTM.

odersky added a commit that referenced this pull request Jun 19, 2015
@odersky odersky merged commit bb75d40 into scala:master Jun 19, 2015
@allanrenucci allanrenucci deleted the fix-patmat-seq branch December 14, 2017 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants