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

Add error message when type of insertMeta is explicitly set #1105

Open
mosyp opened this issue May 21, 2018 · 4 comments
Open

Add error message when type of insertMeta is explicitly set #1105

mosyp opened this issue May 21, 2018 · 4 comments

Comments

@mosyp
Copy link
Collaborator

mosyp commented May 21, 2018

Version: latest
Module: quill-core

When type of insertMeta is explicitly set

implicit val personInsertMeta: InsertMeta[Person] = insertMeta[Person](_.name)

then insert query produces wrong sql:

INSERT INTO person (age) VALUES (age)

Expected behavior

Add compiler error

Steps to reproduce the behavior

https://scastie.scala-lang.org/ogQBs2YVSbS4sMRJthFVqA

Workaround

Remove explicit type of insertMeta

@getquill/maintainers

@JustAHappyKid
Copy link

JustAHappyKid commented Dec 2, 2018

I got bit by this bug this week... Took a while to pin down the source of the problem. I put together a test-case that reproduces it, though, if that's of any help.

If someone can point me in the right direction (e.g., another place in the Quill code-base where a compiler error is generated due to an invalid library usage), perhaps I can take a stab at a patch.

owendavies93 added a commit to owendavies93/mandyville-modelling that referenced this issue Apr 28, 2021
Instead of specifying all the fields. We have to remove type
annotations from these insertMeta definitions in order to make
bind parameter lifting work correctly

See zio/zio-quill#1105
@SethTisue
Copy link

I wonder if such mistakes will become more common starting in Scala 2.13.11 because scala/scala#10083 is landing, encouraging users to add explicit types to their implicit defs and implicit vals

related: scala/bug#12798

(not sure if this repo has other tickets in this general area — this is the one I was able to find)

@leszekgruchala
Copy link

@SethTisue We cannot update to 2.13.11 because of this issue. We use -Xsource:3 and I see -Wconf:cat=other-implicit-type:s is simply being ignored with that option together.

@lrytz
Copy link

lrytz commented Jun 19, 2023

Is it possible to spell out the type in source, i.e., is InsertMeta[Person] just not specific enough?

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

No branches or pull requests

6 participants