Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
mio-19 committed Oct 24, 2024
1 parent 287f7c8 commit 73afa0b
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 17 deletions.
13 changes: 6 additions & 7 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -276,14 +276,13 @@ ThisBuild / nativeConfig ~= ((System.getProperty("os.name").toLowerCase, System.
_.withGC(GC.commix)
}
/*
[error] /usr/bin/ld: /tmp/lto-llvm-7d968c.o: relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `__stack_chk_guard@@GLIBC_2.17' which may bind externally can not be used when making a shared object; recompile with -fPIC
[error] /usr/bin/ld: /tmp/lto-llvm-7d968c.o(.text.MutatorThreads_init+0x8): unresolvable R_AARCH64_ADR_PREL_PG_HI21 relocation against symbol `__stack_chk_guard@@GLIBC_2.17'
[error] /usr/bin/ld: final link failed: bad value
[error] clang++: error: linker command failed with exit code 1 (use -v to see invocation)
[info] Total (36687 ms)
[error] /usr/bin/ld: /tmp/lto-llvm-7d968c.o: relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `__stack_chk_guard@@GLIBC_2.17' which may bind externally can not be used when making a shared object; recompile with -fPIC
[error] /usr/bin/ld: /tmp/lto-llvm-7d968c.o(.text.MutatorThreads_init+0x8): unresolvable R_AARCH64_ADR_PREL_PG_HI21 relocation against symbol `__stack_chk_guard@@GLIBC_2.17'
[error] /usr/bin/ld: final link failed: bad value
[error] clang++: error: linker command failed with exit code 1 (use -v to see invocation)
[info] Total (36687 ms)
*/
// Archlinux aarch64 Virtual Machine on Apple Silicon
// Archlinux aarch64 Virtual Machine on Apple Silicon: LTO is broken too
case (linux, "aarch64") if linux.contains("linux") => {
_.withMode(Mode.releaseFast)
.withGC(GC.commix)
Expand Down
4 changes: 2 additions & 2 deletions parser/src/main/scala/chester/parser/Parser.scala
Original file line number Diff line number Diff line change
Expand Up @@ -417,11 +417,11 @@ case class ParserInternal(

def objectClause0: P[ObjectClause] =
(maybeSpace ~ qualifiedName ~ maybeSpace ~ "=" ~ maybeSpace ~ parse() ~ maybeSpace)
.map(ObjectExprClause)
.map(ObjectExprClause.apply)

def objectClause1: P[ObjectClause] =
(maybeSpace ~ parse(ctx = ParsingContext(dontallowOpSeq = true)) ~ maybeSpace ~ "=>" ~ maybeSpace ~ parse() ~ maybeSpace)
.map(ObjectExprClauseOnValue)
.map(ObjectExprClauseOnValue.apply)

def objectParse: P[ParsedExpr] = PwithMeta(
"{" ~ (objectClause0 | objectClause1).rep(sep = comma) ~ comma.? ~ maybeSpace ~ "}"
Expand Down
28 changes: 28 additions & 0 deletions syntax/src/main/scala/chester/syntax/core/Term.scala
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,34 @@ case class RationalTerm(value: Rational, meta: OptionTermMeta) extends LiteralTe
Doc.text(value.toString, ColorProfile.literalColor)
}

trait BooleanTermC[+Rec <: TermT[Rec]] extends LiteralTermT[Rec] {
override type ThisTree <: BooleanTermC[Rec]
def value: Boolean
override def toTerm: BooleanTerm = BooleanTerm(value, meta)
}

case class BooleanTerm(value: Boolean, meta: OptionTermMeta) extends LiteralTerm with BooleanTermC[Term] derives ReadWriter {
override type ThisTree = BooleanTerm
override def descent(f: Term => Term, g: SpecialMap): BooleanTerm = this

override def toDoc(using options: PrettierOptions): Doc =
Doc.text(value.toString, ColorProfile.literalColor)
}

trait BooleanTypeC[+Rec <: TermT[Rec]] extends TypeTermT[Rec] with WithTypeT[Rec] {
override type ThisTree <: BooleanTypeC[Rec]
override def toTerm: BooleanType = BooleanType(meta)
}

case class BooleanType(meta: OptionTermMeta) extends TypeTerm with WithType with BooleanTypeC[Term] derives ReadWriter {
override type ThisTree = BooleanType
override def descent(f: Term => Term, g: SpecialMap): BooleanType = this

override def ty: Term = Type0
override def toDoc(using options: PrettierOptions): Doc =
Doc.text("Boolean", ColorProfile.typeColor)
}

trait StringTermC[+Rec <: TermT[Rec]] extends LiteralTermT[Rec] {
override type ThisTree <: StringTermC[Rec]
def value: String
Expand Down
4 changes: 1 addition & 3 deletions tyck/src/main/scala/chester/resolve/Desalt.scala
Original file line number Diff line number Diff line change
Expand Up @@ -582,9 +582,7 @@ case object SimpleDesalt {
}
}

private def parseExtendsClause(tokens: List[Expr], meta: Option[ExprMeta])(using
reporter: Reporter[TyckProblem]
): (Option[ExtendsClause], List[Expr]) = {
private def parseExtendsClause(tokens: List[Expr], meta: Option[ExprMeta]): (Option[ExtendsClause], List[Expr]) = {
tokens match {
case Identifier(Const.`<:`, _) :: rest =>
val (superTypes, remainingTokens) = parseSuperTypes(rest)
Expand Down
12 changes: 7 additions & 5 deletions utils/shared/src/main/scala/chester/i18n/macros.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ trait T {
}

private def tMacro(sc: Expr[StringContext])(using Quotes): Expr[T] = {
println(sc.show)
println(System.getProperty("user.dir"))
println("aaa")
// it works
// Files.write(Paths.get("/Users/.../test.output"), sc.show.getBytes, StandardOpenOption.CREATE, StandardOpenOption.APPEND)
if (false) {
println(sc.show)
println(System.getProperty("user.dir"))
println("aaa")
// it works
// Files.write(Paths.get("/Users/.../test.output"), sc.show.getBytes, StandardOpenOption.CREATE, StandardOpenOption.APPEND)
}
'{
new T {
def t(args: Any*)(using lang: Language): String = {
Expand Down

0 comments on commit 73afa0b

Please sign in to comment.