Skip to content
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

ScalaCL: Type mismatch #19

Open
ochafik opened this issue Mar 18, 2015 · 0 comments
Open

ScalaCL: Type mismatch #19

ochafik opened this issue Mar 18, 2015 · 0 comments
Labels

Comments

@ochafik
Copy link
Member

ochafik commented Mar 18, 2015

From @ekasitk on March 18, 2014 5:49

By these two lines:

val input = Array(1,2,3,4,5).cl
val output = input.map( (i:Int) => 1).toArray

the compiler plugin generates the following error in the 2nd line. I use scalacl-0.2 with javacl-1.0.0-RC2.

[scalacl] Test.scala:36 transformed Array[Int].foreach into equivalent while loop.
[scalacl] Converted <<<
1

to <<<
(1)

scala.tools.nsc.symtab.Types$TypeError: type mismatch;
found : Int => Int
required: Int => Int(1)
at scala.tools.nsc.typechecker.Contexts$Context.error(Contexts.scala:298)
at scala.tools.nsc.typechecker.Infer$Inferencer.error(Infer.scala:207)
at scala.tools.nsc.typechecker.Infer$Inferencer.typeError(Infer.scala:21
7) at scala.tools.nsc.typechecker.Infer$Inferencer.typeErrorTree(Infer.scal
a:232)
at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:936)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4283)
at scala.tools.nsc.typechecker.Typers$Typer.typedArg(Typers.scala:2191)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$typedArgs$3.apply(T
ypers.scala:2204)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$typedArgs$3.apply(T
ypers.scala:2203)
at scala.Tuple3$Zipped$$anonfun$map$1.apply(Tuple3.scala:66)
at scala.Tuple3$Zipped$$anonfun$map$1.apply(Tuple3.scala:64)
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.
scala:59)
at scala.collection.immutable.List.foreach(List.scala:76)
at scala.Tuple3$Zipped.map(Tuple3.scala:64)
at scala.tools.nsc.typechecker.Typers$Typer.typedArgs(Typers.scala:2203)
at scala.tools.nsc.typechecker.Typers$Typer.doTypedApply(Typers.scala:24
23)
at scala.tools.nsc.typechecker.Typers$Typer.typedApply$1(Typers.scala:33
74)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4107)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4274)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$typedApply$1$1.appl
y(Typers.scala:3356)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$typedApply$1$1.appl
y(Typers.scala:3356)
at scala.tools.nsc.typechecker.Typers$Typer.silent(Typers.scala:624)
at scala.tools.nsc.typechecker.Typers$Typer.typedApply$1(Typers.scala:33
56)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4107)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4274)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4334)
at scalacl.plugin.ScalaCLFunctionsTransformComponent$$anon$1.scalacl$plu
gin$ScalaCLFunctionsTransformComponent$$anon$$convertFunctionToCLFunction(ScalaC
LFunctionsTransformComponent.scala:283)
at scalacl.plugin.ScalaCLFunctionsTransformComponent$$anon$1$$anonfun$tr
ansform$2.apply(ScalaCLFunctionsTransformComponent.scala:325)
at scalacl.plugin.ScalaCLFunctionsTransformComponent$$anon$1$$anonfun$tr
ansform$2.apply(ScalaCLFunctionsTransformComponent.scala:324)
at scalacl.plugin.TreeBuilders$class.msg(TreeBuilders.scala:61)
at scalacl.plugin.ScalaCLFunctionsTransformComponent.msg(ScalaCLFunction
sTransformComponent.scala:52)
at scalacl.plugin.ScalaCLFunctionsTransformComponent$$anon$1.transform(S
calaCLFunctionsTransformComponent.scala:324)
at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:845)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transf
orm(TypingTransformers.scala:53)
at scalacl.plugin.ScalaCLFunctionsTransformComponent$$anon$1.transform(S
calaCLFunctionsTransformComponent.scala:355)
at scala.tools.nsc.ast.Trees$Transformer$$anonfun$transform$4.apply(Tree
s.scala:777)
at scala.tools.nsc.ast.Trees$Transformer$$anonfun$transform$4.apply(Tree
s.scala:776)
at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:899)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwne
r(TypingTransformers.scala:38)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwne
r(TypingTransformers.scala:31)
at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:775)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transf
orm(TypingTransformers.scala:53)
at scalacl.plugin.ScalaCLFunctionsTransformComponent$$anon$1.transform(S
calaCLFunctionsTransformComponent.scala:355)
at scala.tools.nsc.ast.Trees$Transformer$$anonfun$transformStats$1.apply
(Trees.scala:891)
at scala.tools.nsc.ast.Trees$Transformer$$anonfun$transformStats$1.apply
(Trees.scala:889)
at scala.collection.immutable.List.loop$1(List.scala:148)
at scala.collection.immutable.List.mapConserve(List.scala:164)
at scala.tools.nsc.ast.Trees$Transformer.transformStats(Trees.scala:889)
at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:799)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transf
orm(TypingTransformers.scala:53)
at scalacl.plugin.ScalaCLFunctionsTransformComponent$$anon$1.transform(S
calaCLFunctionsTransformComponent.scala:355)
at scala.tools.nsc.ast.Trees$Transformer$$anonfun$transform$5.apply(Tree
s.scala:783)
at scala.tools.nsc.ast.Trees$Transformer$$anonfun$transform$5.apply(Tree
s.scala:781)
at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:899)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwne
r(TypingTransformers.scala:38)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwne
r(TypingTransformers.scala:31)
at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:780)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transf
orm(TypingTransformers.scala:53)
at scalacl.plugin.ScalaCLFunctionsTransformComponent$$anon$1.transform(S
calaCLFunctionsTransformComponent.scala:355)
at scala.tools.nsc.ast.Trees$Transformer$$anonfun$transformStats$1.apply
(Trees.scala:891)
at scala.tools.nsc.ast.Trees$Transformer$$anonfun$transformStats$1.apply
(Trees.scala:889)
at scala.collection.immutable.List.loop$1(List.scala:148)
at scala.collection.immutable.List.mapConserve(List.scala:164)
at scala.tools.nsc.ast.Trees$Transformer.transformStats(Trees.scala:889)
at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:797)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.scala$
tools$nsc$transform$TypingTransformers$TypingTransformer$$super$transform(Typing
Transformers.scala:49)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer$$anonf
un$transform$1.apply(TypingTransformers.scala:49)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer$$anonf
un$transform$1.apply(TypingTransformers.scala:49)
at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:899)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwne
r(TypingTransformers.scala:38)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwne
r(TypingTransformers.scala:31)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transf
orm(TypingTransformers.scala:49)
at scalacl.plugin.ScalaCLFunctionsTransformComponent$$anon$1.transform(S
calaCLFunctionsTransformComponent.scala:355)
at scala.tools.nsc.ast.Trees$Transformer.transformTemplate(Trees.scala:8
75)
at scala.tools.nsc.ast.Trees$Transformer$$anonfun$transform$3.apply(Tree
s.scala:772)
at scala.tools.nsc.ast.Trees$Transformer$$anonfun$transform$3.apply(Tree
s.scala:771)
at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:899)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwne
r(TypingTransformers.scala:38)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwne
r(TypingTransformers.scala:31)
at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:770)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transf
orm(TypingTransformers.scala:53)
at scalacl.plugin.ScalaCLFunctionsTransformComponent$$anon$1.transform(S
calaCLFunctionsTransformComponent.scala:355)
at scala.tools.nsc.ast.Trees$Transformer$$anonfun$transformStats$1.apply
(Trees.scala:891)
at scala.tools.nsc.ast.Trees$Transformer$$anonfun$transformStats$1.apply
(Trees.scala:889)
at scala.collection.immutable.List.loop$1(List.scala:148)
at scala.collection.immutable.List.mapConserve(List.scala:164)
at scala.tools.nsc.ast.Trees$Transformer.transformStats(Trees.scala:889)
at scala.tools.nsc.ast.Trees$Transformer$$anonfun$transform$1.apply(Tree
s.scala:761)
at scala.tools.nsc.ast.Trees$Transformer$$anonfun$transform$1.apply(Tree
s.scala:761)
at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:899)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwne
r(TypingTransformers.scala:38)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwne
r(TypingTransformers.scala:31)
at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:760)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.scala$
tools$nsc$transform$TypingTransformers$TypingTransformer$$super$transform(Typing
Transformers.scala:49)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer$$anonf
un$transform$2.apply(TypingTransformers.scala:51)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer$$anonf
un$transform$2.apply(TypingTransformers.scala:51)
at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:899)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwne
r(TypingTransformers.scala:38)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwne
r(TypingTransformers.scala:31)
at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transf
orm(TypingTransformers.scala:51)
at scalacl.plugin.ScalaCLFunctionsTransformComponent$$anon$1.transform(S
calaCLFunctionsTransformComponent.scala:355)
at scala.tools.nsc.ast.Trees$Transformer.transformUnit(Trees.scala:892)
at scala.tools.nsc.transform.Transform$Phase.apply(Transform.scala:30)
at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:329)
at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:
297)
at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:
297)
at scala.collection.Iterator$class.foreach(Iterator.scala:772)
at scala.collection.mutable.ListBuffer$$anon$1.foreach(ListBuffer.scala:
318)
at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:297)
at scala.tools.nsc.Global$Run.compileSources(Global.scala:953)
at scala.tools.nsc.Global$Run.compile(Global.scala:1041)
at scala.tools.nsc.Main$.process(Main.scala:106)
at scala.tools.nsc.Main$.main(Main.scala:123)
at scala.tools.nsc.Main.main(Main.scala)
warning: [scalacl] Test.scala:35 An unexpected error occurred while attempting an optimization

Copied from original issue: nativelibs4java/nativelibs4java#486

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant