代码之家  ›  专栏  ›  技术社区  ›  user51

错误选项:“-yliteral类型”sbt

  •  0
  • user51  · 技术社区  · 6 年前

    我在斯卡拉以下 build.sbt 文件。

    scalaVersion := "2.12.8"
    
    val ccompileOptions = Seq(
      "-unchecked",
      "-deprecation",
      "-language:_",
      "-encoding", "UTF-8",
      "-Ypartial-unification",
      "-Xfatal-warnings",
      "-Yliteral-types",
      "-language:higherKinds"
    )
    
    scalacOptions ++= ccompileOptions
    
    enablePlugins(TutPlugin)
    
    tutTargetDirectory := baseDirectory.value
    
    resolvers += Resolver.bintrayRepo("ovotech", "maven")
    
    libraryDependencies ++= Seq(
      "is.cir" %% "ciris-cats",
      "is.cir" %% "ciris-cats-effect",
      "is.cir" %% "ciris-core",
      "is.cir" %% "ciris-enumeratum",
      "is.cir" %% "ciris-refined"
    ).map(_ % "0.12.1")
    
    libraryDependencies ++= Seq(
      "org.http4s" %% "http4s-dsl",
      "org.http4s" %% "http4s-blaze-server"
    ).map(_ % "0.19.0")
    
    libraryDependencies ++= Seq(
      "com.ovoenergy" %% "ciris-kubernetes" % "0.5" ,
      "org.typelevel" %% "kittens" % "1.2.0",
      "eu.timepit" %% "refined-cats" % "0.9.3"
    )
    

    该项目可在Github找到 here . 只需要更新scaleaversion到 2.12.8 并对此发表评论 section .

    如果我删除 scalaVersion := "2.12.8" 然后添加以下内容,编译成功。

    inThisBuild {
      Seq(
        scalaOrganization := "org.typelevel",
        scalaVersion := "2.12.4-bin-typelevel-4"
      )
    }
    

    当我谷歌搜索时,看起来像 -Yliteral-types 根据此从scala中删除选项 issue .

    但是我创建了一个项目 scala version 2.12.8 用那个 -字形类型 启用标志 here 而且工作正常。

    2 回复  |  直到 6 年前
        1
  •  1
  •   Mark Kegel    6 年前

    是的,您将不得不使用dotty或typelevel编译器来访问您发现的这个特性。而 SIP-23 不要把这一点说得很清楚,上面提供的链接和文档结合起来就可以了。

        2
  •  1
  •   Dmytro Mitin    6 年前

    带scala插件的Intellij IDEA显示消息:

    对于文本类型支持,请使用scala 2.13或typelevel scala -Yliteral-types 编译器标志。

    enter image description here