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

SI-8263 Avoid SOE in logicallyEnclosingMember #3506

Merged
merged 1 commit into from Feb 12, 2014

Conversation

retronym
Copy link
Member

Not sure when the regression hit, but we're seeing this in the
SBT build. It's probably a mistake to be calling this method
on somthing that isn't owned by a method, but let's not SOE
in that case.

This is analagous with the way the NoSymbol#owner doesnt throw
and exception anymore.

Review by @gkossakowski

@gkossakowski
Copy link
Member

The fde88c7 introduced some loggging behind -Xdev option. Does it make sense to do the same in this case?

@retronym
Copy link
Member Author

Yeah, that would be consistent. I've also found the root cause: a macro SBT creates a symbol owned by NoSymbol. I'll submit that fix to SBT, but I think we should also merge this patch (once amended with your suggestion)

@gkossakowski
Copy link
Member

If the problem is on sbt side then why it doesn't crash on 2.10.x?

W dniu środa, 12 lutego 2014 Jason Zaugg notifications@github.com
napisał(a):

Yeah, that would be consistent. I've also found the root cause: a macro
SBT creates a symbol owned by NoSymbol. I'll submit that fix to SBT, but
I think we should also merge this patch (once amended with your suggestion)


Reply to this email directly or view it on GitHubhttps://github.com//pull/3506#issuecomment-34860609
.

Grzegorz Kossakowski
Scalac hacker at Typesafe http://www.typesafe.com/
twitter: @gkossakowski http://twitter.com/gkossakowski
github: @gkossakowski http://github.com/gkossakowski

@retronym
Copy link
Member Author

See: sbt/sbt#1113

@retronym
Copy link
Member Author

If the problem is on sbt side then why it doesn't crash on 2.10.x?

We uncovered the problem with the fix for SI-2066.

We've started calling this method during higher-kinded subtyping
to ensure that variances of higher order type params in overriding
as soundly aligned.

Turns out that running this over the expansion of the SBT task
macro leads to a SOE due to a corrupt owner chain.

I've fixed that in SBT (sbt/sbt#1113),
but we ought not crash like this.

This commit considers NoSymbol to be its own enclosing member and
logs a -Xdev warning. This is analagous to the handling of
`NoSymbol.owner`.
@retronym
Copy link
Member Author

@gkossakowski I've also updated this PR with a more detailed commit comment and a -Xdev warning.

@gkossakowski
Copy link
Member

After thinking about it some more I wonder if fde88c7 and 555db25 are going in the right direction. Asking anything about NoSymbol makes no sense so why not just fail fast?

In particular, SOE exhibited a real bug in sbt. If this patch was merged we wouldn't see the bug or it would fail in some other, more distant (from macro expansion logic) place. I don't see that as an improvement.

I might have expressed that concern around the time fde88c7 was merged but I can't find the outcome of our discussion.

@retronym
Copy link
Member Author

It is at least consistent with:

    override def isHigherOrderTypeParameter = false
    override def companionClass = NoSymbol
    override def companionModule = NoSymbol
    override def companionSymbol = NoSymbol
    override def isSubClass(that: Symbol) = false
    override def filter(cond: Symbol => Boolean) = this
    override def defString: String = toString
    override def locationString: String = ""
    override def enclClassChain = Nil
    override def enclClass: Symbol = this
    override def enclosingTopLevelClass: Symbol = this
    override def enclosingPackageClass: Symbol = this
    override def enclMethod: Symbol = this

owner was the odd man out.

@gkossakowski
Copy link
Member

Fair enough. I think I'll want to revisit this design choice in 2.12.

@gkossakowski
Copy link
Member

LGTM.

I'll merge once tests pass.

adriaanm added a commit that referenced this pull request Feb 12, 2014
@adriaanm adriaanm merged commit 3aec42f into scala:master Feb 12, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants