Skip to content

Fix issues to make new collections compile again #4162

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 3 commits into from
Mar 22, 2018

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Mar 22, 2018

  1. Revert Do not allow named self in objects #4118
  2. Better disambiguation to avoid MergeErrors

@odersky odersky requested a review from smarter March 22, 2018 21:40
@@ -523,7 +529,9 @@ object Denotations {
try infoMeet(info1, info2)
catch {
case ex: MergeError =>
if (pre.widen.classSymbol.is(Scala2x) || ctx.scala2Mode)
if (preferSym(sym2, sym1)) info2
Copy link
Member

Choose a reason for hiding this comment

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

Would it be difficult to construct a test case to exercise this? Also, are we confident this is sound?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried for a while but did not manage. The code that breaks is in class Id in MapView of the collection strawman.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Regarding soundness: What happens is that we get two denotations that should be overloaded and we pick one and forget about the other. I see that as a possible problem for completeness, not sure how it would affect soundness.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe add a comment to note that this may be worth revisiting at some point?

@@ -12,10 +12,10 @@ import * as vscode from 'vscode';
import * as dotty from '../src/extension';

// Defines a Mocha test suite to group tests of similar kind together
suite("vscode-dotty tests", function () {
//suite("vscode-dotty tests", function () {
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't be necessary anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That was added by accident. I removed it now.

If there's a MergeError we now disambiguate following symbol preference. This is needed
to make new collections compile. Also, better error messages for those cases where a
MergeError is still emitted.
@odersky odersky merged commit abb6f36 into scala:master Mar 22, 2018
@Blaisorblade Blaisorblade deleted the revert-self branch March 23, 2018 14:52
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