【发布时间】:2020-06-30 08:55:23
【问题描述】:
我有一段代码,我在其中明确传递了一个类型参数,该类型参数被 intelliJ 很好地拾取,并且 intelliJ 没有指出错误,但是当我使用系统 sbt 编译相同的代码时,它不会拿起类型参数并与范围内的多个匹配隐式类型混淆。
在系统 sbt 上编译时的错误堆栈:
[error] one error found
[error] /Users/xxxxxx/projects/xxxxx-xxxxxx-xxxxxx/xxxxxxxxx/src/main/scala/com/xxxxxxx/Main.scala:93:33: ambiguous implicit values:
[error] both lazy value AsyncBlobIO in trait Instances of type => cats.effect.Async[doobie.free.BlobIO]
[error] and lazy value AsyncCallableStatementIO in trait Instances of type => cats.effect.Async[doobie.free.CallableStatementIO]
[error] match expected type cats.effect.Sync[F]
[error] result <- jobPaths(Paths.get(record.path), settings.baseFolder).use(paths => ingestionJob(record, paths))
[error] ^
如您所见,系统 sbt 没有选择类型参数 jobPaths[IO](..),而是出于某种原因只运行 jobPaths(..)。
JobPaths 函数定义如果有帮助的话:
def runJob[F[_]](
settings: Settings,
now: Instant,
consulSessionName: String,
assignerConfig: PartitionKeyAssignerConfig
)(implicit F: ConcurrentEffect[F], p: Parallel[F]): F[Unit] = {
系统sbt版本:
[info] 1.2.8
sbt script version: 1.3.12
我是否以正确的方式看待问题?还是这是由其他原因引起的?
任何事情都会有帮助。
【问题讨论】:
标签: scala intellij-idea sbt scala-cats