Skip to content

-Ylog:X now only log phase X, use -Ylog:X+ to also log phase X+1 #308

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 1 commit into from
Dec 18, 2014

Conversation

smarter
Copy link
Member

@smarter smarter commented Dec 18, 2014

This supersedes #273.
Review by @odersky .

*/
implicit class PhaseListDecorator(val names: List[String]) extends AnyVal {
def containsPhase(phase: Phase): Boolean = phase match {
case phase: TreeTransformer => phase.transformations.exists(trans => containsPhase(trans.phase))
case _ => names exists (n => n == "all" || phase.phaseName.startsWith(n))
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe the logic can be simplified and made clearer as follows:

case _ => 
    names exists { n =>
       n == "all" || {
          val strippedName = name.stripSuffix("+")
          val indicatedPhase = if (name == strippedName) phase else phase.prev
          indicatedPhase.phaseName.startsWith(strippedName)
      }
   }  

Copy link
Member Author

Choose a reason for hiding this comment

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

No, that doesn't work, if we have a "+" we want to match on both phase and phase.prev, we could use a list but that seems overkill, what do you think of:

case _ => 
    names exists { n =>
       n == "all" || {
          val strippedName = name.stripSuffix("+")
          val logNextPhase = name ne strippedName
          phase.phaseName.startsWith(strippedName) ||
            (logNextPhase && phase.prev.phaseName.startsWith(strippedName))
      }
   }

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah I thought of a different spec. But yours makes more sense, I think. The change looks good.

@odersky
Copy link
Contributor

odersky commented Dec 18, 2014

Otherwise LGTM

@smarter
Copy link
Member Author

smarter commented Dec 18, 2014

Should be good to be merged now.

odersky added a commit that referenced this pull request Dec 18, 2014
-Ylog:X now only log phase X, use -Ylog:X+ to also log phase X+1
@odersky odersky merged commit f3c0eaa into scala:master Dec 18, 2014
tgodzik added a commit to tgodzik/scala3 that referenced this pull request Apr 29, 2025
Backport "Restore resolving prefixes of implicit Ident" to 3.3 LTS
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