-
Notifications
You must be signed in to change notification settings - Fork 70
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
Adding -source:future causes compilation errors due to deprecated wildcard syntax #496
Comments
As a workaround, you could probably use a multi-module build and code-generate in a separate module, so that your application code could still use We'll probably provide a pathway to opt-in |
You can disable warnings in generated sources. Might be a good idea because at some point smithy4s might start generating I'm using something like this in one of the projects:
edit: unless this is actually an error and not a warning + |
@Baccata I would love to contribute (smithy4s is awesome!) but would definitely need some guidance as I don't have any OSS experience. |
The biggest problem right now would probably be to figure out how the users would configure this... but as long as you can parameterize the renderer with something, we can probably figure that out later - you could start a PR that hardcodes the renderer to use the Scala 3 syntax, and we could pick it up later to pass that all the way from whatever is going to set that. I'm thinking codegen-cli / sbt-plugin / mill-plugin settings. That being unclear, here are some things that are clear atm and should be useful if you want to give this a shot: 1. Where's the codeIn general, you're gonna work in the Generating code roughly starts in the
The exact look of the generated code is only a concern of the latter, which lives in You can look around and draw some inspiration from #599 which touches a couple areas in the renderer. 2. How to check that it worksThe testing ability is quite limited as of now, as testing is mostly done by either:
I'd say your best feedback loop will be this:
I would suggest that you start with small changes (e.g. adding some whitespace, or just random stuff really). 3. Other development notesMake sure you're branching off from For this feature, I think we're gonna want to add some sort of def wildcardArgument: String
def wildcardImport: String
//etc the provider of the config would specify the correct symbols to use. We would use these members wherever we currently use plain symbols. @scala-impala sorry for the long wait, but I also didn't know that much about the renderer to provide any useful hints before :) |
That is a very accurate hunch over why this is tricky. Ideally you wouldn't have to configure anything and the plugin would derive it directly from the fact that the project is using the Scala 3 compiler and has a particular flag set-up, but that's involved. What we've been staring to do is use "smithy4s"-prefixed smithy metadata for this kind of stuff. It might be where the configuration should live, for the time being anyway. |
I thought about this... are we guaranteed to get separate generated sources for each Scala version in the build matrix?
I'm not sure this is very user-friendly, though. You might be consuming a library containing Smithy specs and not want to set up any Smithy files for this. Also, I take it that metadata would only have effect on the namespace it's contained in? |
Nope, metadata is a global, somewhat-semigroupal value.
Way ahead of you |
Wow, totally misread/mis-responded. Right. So I think I'd be adversed to having options related to rendering live outside of smithy files. Providing other means of configuration would have the effect of increasing maintenance burden, and would lose the effect of teaching our users about the smithy language and what it allows for. For instance, you can control some aspects on the rendering by applying some traits to shapes a-posteriori. It teaches the user that traits can be applied via the At the end of the day, the configuration has to happen somewhere. It makes sense to me to use smithy files for this, because it works in all contexts (build-tools / clis) without having to multiply the same code in places. |
That last point convinces me. |
wait, we should also do this for imports, right? |
what do you mean imports ? |
scala 2
scala 3
|
On Scala 3.2.0, adding the "-source:future" compiler option causes compilation to fail with the following error message:
_ is deprecated for wildcard arguments of types: use ? instead
The text was updated successfully, but these errors were encountered: