Skip to content
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

don't try to create tags w/o scala-reflect.jar #1360

Merged
merged 1 commit into from
Sep 20, 2012

Conversation

xeno-by
Copy link
Contributor

@xeno-by xeno-by commented Sep 20, 2012

Since recently type tags have relocated to scala-reflect.jar,
meaning that they are no longer always on library classpath.

In the compiler we do have code that generates type tags, and this code
is bound to fail if scala-reflect.jar isn't there.

I though this wouldn't be a problem, because type tag materialization
is only going to be triggered by users explicitly requesting a type tag.

That's generally true, but I overlooked a corner case. Since we provide
manifest <-> type tag compatibility, manifest lookup can sometimes trigger
tag lookup, which might result in tag synthesis, which blows up like this:
http://groups.google.com/group/scala-internals/browse_thread/thread/166ce4b71b7c46bb

@xeno-by
Copy link
Contributor Author

xeno-by commented Sep 20, 2012

review @dragos @odersky

@gkossakowski
Copy link
Contributor

From the test-case it's not clear to me what will happen exactly? Is bailing out silently the right behavior?

@scala-jenkins
Copy link

Started jenkins job pr-rangepos at https://scala-webapps.epfl.ch/jenkins/job/pr-rangepos/541/

@scala-jenkins
Copy link

Started jenkins job pr-scala-testsuite-linux-opt at https://scala-webapps.epfl.ch/jenkins/job/pr-scala-testsuite-linux-opt/1249/

@scala-jenkins
Copy link

jenkins job pr-rangepos: Failed - https://scala-webapps.epfl.ch/jenkins/job/pr-rangepos/541/

@scala-jenkins
Copy link

jenkins job pr-scala-testsuite-linux-opt: Failed - https://scala-webapps.epfl.ch/jenkins/job/pr-scala-testsuite-linux-opt/1249/

@xeno-by
Copy link
Contributor Author

xeno-by commented Sep 20, 2012

killed the kitteh on purpose, since we've got an update for the pull request

@xeno-by
Copy link
Contributor Author

xeno-by commented Sep 20, 2012

PLS REBUILD ALL

@xeno-by
Copy link
Contributor Author

xeno-by commented Sep 20, 2012

@gkossakowski updated the pull request with more explanations

@scala-jenkins
Copy link

Started jenkins job pr-rangepos at https://scala-webapps.epfl.ch/jenkins/job/pr-rangepos/543/

@scala-jenkins
Copy link

Started jenkins job pr-scala-testsuite-linux-opt at https://scala-webapps.epfl.ch/jenkins/job/pr-scala-testsuite-linux-opt/1251/

@scala-jenkins
Copy link

jenkins job pr-rangepos: Success - https://scala-webapps.epfl.ch/jenkins/job/pr-rangepos/543/

@scala-jenkins
Copy link

jenkins job pr-scala-testsuite-linux-opt: Success - https://scala-webapps.epfl.ch/jenkins/job/pr-scala-testsuite-linux-opt/1251/

@xeno-by
Copy link
Contributor Author

xeno-by commented Sep 20, 2012

updated with more tests

Since recently type tags have relocated to scala-reflect.jar,
meaning that they are no longer always on library classpath.

In the compiler we do have code that generates type tags, and this code
is bound to fail if scala-reflect.jar isn't there.

I though this wouldn't be a problem, because type tag materialization
is only going to be triggered by users explicitly requesting a type tag.

That's generally true, but I overlooked a corner case. Since we provide
manifest <-> type tag compatibility, manifest lookup can sometimes trigger
tag lookup, which might result in tag synthesis, which blows up like this:
http://groups.google.com/group/scala-internals/browse_thread/thread/166ce4b71b7c46bb

This commit also ensures that type tag generation/interop doesnt sneak into the
code of the libraries that don't have scala-reflect.jar on their classpath.
For details refer to the discussion at scala-internals:
http://groups.google.com/group/scala-internals/browse_thread/thread/72f6ce3010f4d8
@xeno-by
Copy link
Contributor Author

xeno-by commented Sep 20, 2012

PLS REBUILD ALL

@scala-jenkins
Copy link

Started jenkins job pr-rangepos at https://scala-webapps.epfl.ch/jenkins/job/pr-rangepos/545/

@scala-jenkins
Copy link

Started jenkins job pr-scala-testsuite-linux-opt at https://scala-webapps.epfl.ch/jenkins/job/pr-scala-testsuite-linux-opt/1253/

@scala-jenkins
Copy link

jenkins job pr-scala-testsuite-linux-opt: Success - https://scala-webapps.epfl.ch/jenkins/job/pr-scala-testsuite-linux-opt/1253/

@scala-jenkins
Copy link

jenkins job pr-rangepos: Success - https://scala-webapps.epfl.ch/jenkins/job/pr-rangepos/545/

resolveTag(pos, taggedTp, allowMaterialization)
}
def resolveTypeTag(pos: Position, pre: Type, tp: Type, concrete: Boolean, allowMaterialization: Boolean = true): Tree =
// if someone requests a type tag, but scala-reflect.jar isn't on the library classpath, then bail
Copy link
Contributor

Choose a reason for hiding this comment

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

This would seem to merit an explanatory warning right here, rather than waiting for less specific errors to trickle up.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The combination of input argument that leads to bailing comes from manifest lookup (to support manifest <-> type tag convertibility).

I think it would be an overkill to warn the user every time just because he's using manifests and happens not to have scala-reflect.jar on the classpath.

Copy link
Contributor

Choose a reason for hiding this comment

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

Mmm. OK, I'll take your word for it. LGTM then.

xeno-by added a commit that referenced this pull request Sep 20, 2012
don't try to create tags w/o scala-reflect.jar
@xeno-by xeno-by merged commit bdae2f2 into scala:2.10.x Sep 20, 2012
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.

4 participants