{"action":"opened","issue":{"url":"https://api.github.com/repos/getquill/quill/issues/522","repository_url":"https://api.github.com/repos/getquill/quill","labels_url":"https://api.github.com/repos/getquill/quill/issues/522/labels{/name}","comments_url":"https://api.github.com/repos/getquill/quill/issues/522/comments","events_url":"https://api.github.com/repos/getquill/quill/issues/522/events","html_url":"https://github.com/getquill/quill/issues/522","id":172285461,"number":522,"title":"NullPointerException when calling function returning query in quoted code","user":{"login":"lbialy","id":8607442,"avatar_url":"https://avatars.githubusercontent.com/u/8607442?v=3","gravatar_id":"","url":"https://api.github.com/users/lbialy","html_url":"https://github.com/lbialy","followers_url":"https://api.github.com/users/lbialy/followers","following_url":"https://api.github.com/users/lbialy/following{/other_user}","gists_url":"https://api.github.com/users/lbialy/gists{/gist_id}","starred_url":"https://api.github.com/users/lbialy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lbialy/subscriptions","organizations_url":"https://api.github.com/users/lbialy/orgs","repos_url":"https://api.github.com/users/lbialy/repos","events_url":"https://api.github.com/users/lbialy/events{/privacy}","received_events_url":"https://api.github.com/users/lbialy/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-08-20T19:00:36Z","updated_at":"2016-08-20T19:00:36Z","closed_at":null,"body":"As in title.\r\n\r\n**Version**: (e.g. `0.4.1-SNAPSHOT`)\r\n**Module**: (e.g. `quill-jdbc`)\r\n\r\n#### Given:\r\n```\r\ncase class User(id: Long, address: String, email: String, currentAge: Int, profileId: Long)\r\n\r\nval users = quote {\r\n    query[User].schema(_.columns(_.profileId -> \"profileId\", _.currentAge -> \"currentAge\"))\r\n}\r\n  \r\ndef ageBetween(min: Int, max: Int) = quote {\r\n    users.filter(u => u.currentAge >= lift(min) && u.currentAge <= lift(max))\r\n}\r\n\r\nval emailsOfUsersBetween20YrsAnd30Yrs = quote {\r\n    ageBetween(20, 30).map(_.email)\r\n}\r\n```\r\n\r\n### Expected behavior\r\n```\r\nSELECT u.email FROM user u WHERE u.current_age >= ? AND u.current_age <= ?\r\n```\r\n### Actual behavior\r\n```\r\njava.lang.NullPointerException\r\n        at scala.tools.nsc.symtab.classfile.Pickler$Pickle.scala$tools$nsc$symtab$classfile$Pickler$Pickle$$putType(Pickler.scala:257)\r\n        at scala.tools.nsc.symtab.classfile.Pickler$Pickle$putTreeTraverser$.put(Pickler.scala:272)\r\n        at scala.tools.nsc.symtab.classfile.Pickler$Pickle.scala$tools$nsc$symtab$classfile$Pickler$Pickle$$putTree(Pickler.scala:281)\r\n        at scala.tools.nsc.symtab.classfile.Pickler$Pickle$putTreeTraverser$.traverse(Pickler.scala:268)\r\n        at scala.tools.nsc.symtab.classfile.Pickler$Pickle$putTreeTraverser$.traverse(Pickler.scala:262)\r\n        at scala.reflect.api.Trees$Traverser.traverseTrees(Trees.scala:2484)\r\n        at scala.reflect.internal.Trees$class.traverseComponents$1(Trees.scala:1234)\r\n        at scala.reflect.internal.Trees$class.itraverse(Trees.scala:1330)\r\n        at scala.reflect.internal.SymbolTable.itraverse(SymbolTable.scala:16)\r\n        at scala.reflect.internal.SymbolTable.itraverse(SymbolTable.scala:16)\r\n        at scala.reflect.api.Trees$Traverser.traverse(Trees.scala:2475)\r\n        at scala.tools.nsc.symtab.classfile.Pickler$Pickle$putTreeTraverser$.put(Pickler.scala:276)\r\n        at scala.tools.nsc.symtab.classfile.Pickler$Pickle.scala$tools$nsc$symtab$classfile$Pickler$Pickle$$putTree(Pickler.scala:281)\r\n        at scala.tools.nsc.symtab.classfile.Pickler$Pickle$putTreeTraverser$.traverse(Pickler.scala:268)\r\n        at scala.tools.nsc.symtab.classfile.Pickler$Pickle$putTreeTraverser$.traverse(Pickler.scala:262)\r\n        at scala.reflect.internal.Trees$class.traverseComponents$1(Trees.scala:1294)\r\n        at scala.reflect.internal.Trees$class.itraverse(Trees.scala:1330)\r\n        at scala.reflect.internal.SymbolTable.itraverse(SymbolTable.scala:16)\r\n        at scala.reflect.internal.SymbolTable.itraverse(SymbolTable.scala:16)\r\n        at scala.reflect.api.Trees$Traverser.traverse(Trees.scala:2475)\r\n        at scala.tools.nsc.symtab.classfile.Pickler$Pickle$putTreeTraverser$.put(Pickler.scala:276)\r\n        at scala.tools.nsc.symtab.classfile.Pickler$Pickle.scala$tools$nsc$symtab$classfile$Pickler$Pickle$$putTree(Pickler.scala:281)\r\n        at scala.tools.nsc.symtab.classfile.Pickler$Pickle$putTreeTraverser$.traverse(Pickler.scala:268)\r\n        at scala.tools.nsc.symtab.classfile.Pickler$Pickle$putTreeTraverser$.traverse(Pickler.scala:262)\r\n        at scala.reflect.api.Trees$Traverser.traverseTrees(Trees.scala:2484)\r\n        at scala.reflect.internal.Trees$class.traverseComponents$1(Trees.scala:1284)\r\n        at scala.reflect.internal.Trees$class.itraverse(Trees.scala:1330)\r\n        at scala.reflect.internal.SymbolTable.itraverse(SymbolTable.scala:16)\r\n        at scala.reflect.internal.SymbolTable.itraverse(SymbolTable.scala:16)\r\n        at scala.reflect.api.Trees$Traverser.traverse(Trees.scala:2475)\r\n        at scala.tools.nsc.symtab.classfile.Pickler$Pickle$putTreeTraverser$.put(Pickler.scala:276)\r\n        at scala.tools.nsc.symtab.classfile.Pickler$Pickle.scala$tools$nsc$symtab$classfile$Pickler$Pickle$$putTree(Pickler.scala:281)\r\n        at scala.tools.nsc.symtab.classfile.Pickler$Pickle$putTreeTraverser$.traverse(Pickler.scala:268)\r\n        at scala.tools.nsc.symtab.classfile.Pickler$Pickle$putTreeTraverser$.traverse(Pickler.scala:262)\r\n        at scala.reflect.api.Trees$Traverser.traverseTrees(Trees.scala:2484)\r\n        at scala.reflect.internal.Trees$class.traverseComponents$1(Trees.scala:1284)\r\n        at scala.reflect.internal.Trees$class.itraverse(Trees.scala:1330)\r\n        at scala.reflect.internal.SymbolTable.itraverse(SymbolTable.scala:16)\r\n        at scala.reflect.internal.SymbolTable.itraverse(SymbolTable.scala:16)\r\n        at scala.reflect.api.Trees$Traverser.traverse(Trees.scala:2475)\r\n        at scala.tools.nsc.symtab.classfile.Pickler$Pickle$putTreeTraverser$.put(Pickler.scala:276)\r\n        at scala.tools.nsc.symtab.classfile.Pickler$Pickle.scala$tools$nsc$symtab$classfile$Pickler$Pickle$$putTree(Pickler.scala:281)\r\n        at scala.tools.nsc.symtab.classfile.Pickler$Pickle$putTreeTraverser$.traverse(Pickler.scala:268)\r\n        at scala.tools.nsc.symtab.classfile.Pickler$Pickle$putTreeTraverser$.traverse(Pickler.scala:262)\r\n        at scala.reflect.api.Trees$Traverser.traverseTrees(Trees.scala:2484)\r\n        at scala.reflect.internal.Trees$class.traverseComponents$1(Trees.scala:1284)\r\n        at scala.reflect.internal.Trees$class.itraverse(Trees.scala:1330)\r\n        at scala.reflect.internal.SymbolTable.itraverse(SymbolTable.scala:16)\r\n        at scala.reflect.internal.SymbolTable.itraverse(SymbolTable.scala:16)\r\n        at scala.reflect.api.Trees$Traverser.traverse(Trees.scala:2475)\r\n        at scala.tools.nsc.symtab.classfile.Pickler$Pickle$putTreeTraverser$.put(Pickler.scala:276)\r\n        at scala.tools.nsc.symtab.classfile.Pickler$Pickle.scala$tools$nsc$symtab$classfile$Pickler$Pickle$$putTree(Pickler.scala:281)\r\n        at scala.tools.nsc.symtab.classfile.Pickler$Pickle$putTreeTraverser$.traverse(Pickler.scala:268)\r\n        at scala.tools.nsc.symtab.classfile.Pickler$Pickle$putTreeTraverser$.traverse(Pickler.scala:262)\r\n        at scala.reflect.api.Trees$Traverser.traverseTrees(Trees.scala:2484)\r\n        at scala.reflect.internal.Trees$class.traverseComponents$1(Trees.scala:1284)\r\n        at scala.reflect.internal.Trees$class.itraverse(Trees.scala:1330)\r\n        at scala.reflect.internal.SymbolTable.itraverse(SymbolTable.scala:16)\r\n        at scala.reflect.internal.SymbolTable.itraverse(SymbolTable.scala:16)\r\n        at scala.reflect.api.Trees$Traverser.traverse(Trees.scala:2475)\r\n        at scala.tools.nsc.symtab.classfile.Pickler$Pickle$putTreeTraverser$.put(Pickler.scala:276)\r\n        at scala.tools.nsc.symtab.classfile.Pickler$Pickle.scala$tools$nsc$symtab$classfile$Pickler$Pickle$$putTree(Pickler.scala:281)\r\n        at scala.tools.nsc.symtab.classfile.Pickler$Pickle$putTreeTraverser$.traverse(Pickler.scala:268)\r\n        at scala.tools.nsc.symtab.classfile.Pickler$Pickle$putTreeTraverser$.traverse(Pickler.scala:262)\r\n        at scala.reflect.api.Trees$Traverser.traverseTrees(Trees.scala:2484)\r\n        at scala.reflect.internal.Trees$class.traverseComponents$1(Trees.scala:1284)\r\n        at scala.reflect.internal.Trees$class.itraverse(Trees.scala:1330)\r\n        at scala.reflect.internal.SymbolTable.itraverse(SymbolTable.scala:16)\r\n        at scala.reflect.internal.SymbolTable.itraverse(SymbolTable.scala:16)\r\n        at scala.reflect.api.Trees$Traverser.traverse(Trees.scala:2475)\r\n        at scala.tools.nsc.symtab.classfile.Pickler$Pickle$putTreeTraverser$.put(Pickler.scala:276)\r\n        at scala.tools.nsc.symtab.classfile.Pickler$Pickle.scala$tools$nsc$symtab$classfile$Pickler$Pickle$$putTree(Pickler.scala:281)\r\n        at scala.tools.nsc.symtab.classfile.Pickler$Pickle.scala$tools$nsc$symtab$classfile$Pickler$Pickle$$putAnnotArg$1(Pickler.scala:317)\r\n        at scala.tools.nsc.symtab.classfile.Pickler$Pickle.putAnnotationBody(Pickler.scala:329)\r\n        at scala.tools.nsc.symtab.classfile.Pickler$Pickle.scala$tools$nsc$symtab$classfile$Pickler$Pickle$$putAnnotation(Pickler.scala:304)\r\n        at scala.tools.nsc.symtab.classfile.Pickler$Pickle.putSymbol(Pickler.scala:202)\r\n        at scala.tools.nsc.symtab.classfile.Pickler$Pickle.putSymbols(Pickler.scala:213)\r\n        at scala.tools.nsc.symtab.classfile.Pickler$Pickle.scala$tools$nsc$symtab$classfile$Pickler$Pickle$$putType(Pickler.scala:241)\r\n        at scala.tools.nsc.symtab.classfile.Pickler$Pickle.putSymbol(Pickler.scala:181)\r\n        at scala.tools.nsc.symtab.classfile.Pickler$Pickle.putSymbols(Pickler.scala:213)\r\n        at scala.tools.nsc.symtab.classfile.Pickler$Pickle.scala$tools$nsc$symtab$classfile$Pickler$Pickle$$putType(Pickler.scala:241)\r\n        at scala.tools.nsc.symtab.classfile.Pickler$Pickle.putSymbol(Pickler.scala:181)\r\n        at scala.tools.nsc.symtab.classfile.Pickler$PicklePhase.add$1(Pickler.scala:40)\r\n        at scala.tools.nsc.symtab.classfile.Pickler$PicklePhase.scala$tools$nsc$symtab$classfile$Pickler$PicklePhase$$pickle$1(Pickler.scala:51)\r\n        at scala.tools.nsc.symtab.classfile.Pickler$PicklePhase.scala$tools$nsc$symtab$classfile$Pickler$PicklePhase$$pickle$1(Pickler.scala:47)\r\n        at scala.tools.nsc.symtab.classfile.Pickler$PicklePhase.apply(Pickler.scala:60)\r\n        at scala.tools.nsc.Global$GlobalPhase$$anonfun$applyPhase$1.apply$mcV$sp(Global.scala:440)\r\n        at scala.tools.nsc.Global$GlobalPhase.withCurrentUnit(Global.scala:431)\r\n        at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:440)\r\n        at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:398)\r\n        at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:398)\r\n        at scala.collection.Iterator$class.foreach(Iterator.scala:893)\r\n        at scala.collection.AbstractIterator.foreach(Iterator.scala:1336)\r\n        at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:398)\r\n        at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1501)\r\n        at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1486)\r\n        at scala.tools.nsc.Global$Run.compileSources(Global.scala:1481)\r\n        at scala.tools.nsc.Global$Run.compile(Global.scala:1582)\r\n        at xsbt.CachedCompiler0.run(CompilerInterface.scala:116)\r\n        at xsbt.CachedCompiler0.run(CompilerInterface.scala:95)\r\n        at xsbt.CompilerInterface.run(CompilerInterface.scala:26)\r\n        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\r\n        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n        at java.lang.reflect.Method.invoke(Method.java:498)\r\n        at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:101)\r\n        at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:47)\r\n        at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:41)\r\n        at sbt.compiler.MixedAnalyzingCompiler$$anonfun$compileScala$1$1.apply$mcV$sp(MixedAnalyzingCompiler.scala:50)\r\n        at sbt.compiler.MixedAnalyzingCompiler$$anonfun$compileScala$1$1.apply(MixedAnalyzingCompiler.scala:50)\r\n        at sbt.compiler.MixedAnalyzingCompiler$$anonfun$compileScala$1$1.apply(MixedAnalyzingCompiler.scala:50)\r\n        at sbt.compiler.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:74)\r\n        at sbt.compiler.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:49)\r\n        at sbt.compiler.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:64)\r\n        at sbt.compiler.IC$$anonfun$compileInternal$1.apply(IncrementalCompiler.scala:160)\r\n        at sbt.compiler.IC$$anonfun$compileInternal$1.apply(IncrementalCompiler.scala:160)\r\n        at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:66)\r\n        at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:64)\r\n        at sbt.inc.IncrementalCommon.cycle(IncrementalCommon.scala:32)\r\n        at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:68)\r\n        at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:67)\r\n        at sbt.inc.Incremental$.manageClassfiles(Incremental.scala:95)\r\n        at sbt.inc.Incremental$.compile(Incremental.scala:67)\r\n        at sbt.inc.IncrementalCompile$.apply(Compile.scala:54)\r\n        at sbt.compiler.IC$.compileInternal(IncrementalCompiler.scala:160)\r\n        at sbt.compiler.IC$.incrementalCompile(IncrementalCompiler.scala:138)\r\n        at sbt.Compiler$.compile(Compiler.scala:152)\r\n        at sbt.Compiler$.compile(Compiler.scala:138)\r\n        at sbt.Defaults$.sbt$Defaults$$compileIncrementalTaskImpl(Defaults.scala:860)\r\n        at sbt.Defaults$$anonfun$compileIncrementalTask$1.apply(Defaults.scala:851)\r\n        at sbt.Defaults$$anonfun$compileIncrementalTask$1.apply(Defaults.scala:849)\r\n        at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)\r\n        at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)\r\n        at sbt.std.Transform$$anon$4.work(System.scala:63)\r\n        at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)\r\n        at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)\r\n        at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)\r\n        at sbt.Execute.work(Execute.scala:237)\r\n        at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)\r\n        at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)\r\n        at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)\r\n        at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)\r\n        at java.util.concurrent.FutureTask.run(FutureTask.java:266)\r\n        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)\r\n        at java.util.concurrent.FutureTask.run(FutureTask.java:266)\r\n        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)\r\n        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)\r\n        at java.lang.Thread.run(Thread.java:745)\r\n[error] (compile:compileIncremental) java.lang.NullPointerException\r\n```\r\n### Workaround\r\nInline crashing query into calling query.\r\n\r\n@getquill/maintainers"}}
{"actor":{"display_login":"lbialy"}}