<commit_before>package spire.macros

import scala.reflect.macros.Context

case class SyntaxUtil[C <: Context with Singleton](val c: C) {
  import c.universe._
  import definitions._
  import Flag._

  def name(s: String) = newTermName(c.fresh(s + "$"))

  def names(bs: String*) = bs.toList.map(name)

  def isClean(es: c.Expr[_]*): Boolean =
    es.forall {
      _.tree match {
        case t @ Ident(_: TermName) if t.symbol.asTerm.isStable => true
        case Function(_, _) => true
        case _ => false
      }
    }
}

class InlineUtil[C <: Context with Singleton](val c: C) {
  import c.universe._

  def inlineAndReset[T](tree: Tree): c.Expr[T] = {
    val inlined = inlineApplyRecursive(tree)
    c.Expr[T](c.resetAllAttrs(inlined))
  }<commit_msg>use resetLocalAttrs to fix inlining bugs<commit_after>package spire.macros

import scala.reflect.macros.Context

case class SyntaxUtil[C <: Context with Singleton](val c: C) {
  import c.universe._
  import definitions._
  import Flag._

  def name(s: String) = newTermName(c.fresh(s + "$"))

  def names(bs: String*) = bs.toList.map(name)

  def isClean(es: c.Expr[_]*): Boolean =
    es.forall {
      _.tree match {
        case t @ Ident(_: TermName) if t.symbol.asTerm.isStable => true
        case Function(_, _) => true
        case _ => false
      }
    }
}

class InlineUtil[C <: Context with Singleton](val c: C) {
  import c.universe._

  def inlineAndReset[T](tree: Tree): c.Expr[T] = {
    val inlined = inlineApplyRecursive(tree)
    //c.Expr[T](c.resetAllAttrs(inlined))
    c.Expr[T](c.resetLocalAttrs(inlined))
  }
{'fraction_non_alphanumeric': 0.1393596986817326, 'fraction_numerical': 0.0, 'mean_word_length': 3.161879895561358, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5099740', 'n_tokens_mistral': 578, 'n_tokens_neox': 563, 'n_words': 130}