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

Suggest: Add -Xfatal-warnings to build #49

Open
malcolmgreaves opened this issue Nov 7, 2016 · 0 comments
Open

Suggest: Add -Xfatal-warnings to build #49

malcolmgreaves opened this issue Nov 7, 2016 · 0 comments

Comments

@malcolmgreaves
Copy link

I suggest turning all build warnings into compiler errors. I have noticed that there are lots of potentially fatal errors lurking in Delite's codebase. There are many (>50) instances of code that relies upon not-present functionality. Specifically, pattern matching on something's type when that type information will not be present due to Java's runtime type erasure.

The standard ways to do this behavior w/in Scala use ClassTags. There's also TypeTags and Manifests, which are built for this exact thing. [1] However, there's an incompatibility w/ TypeTag for Scala 2.10 (iirc): only works on 2.11.

In my experience, I've been able to do a lot of runtime type checking by using a ClassTag, getting the actual type's runtime type (as a Class instance), then checking to see if that is the same type that we're looking for. This is a good resource [2].

For the flag, we'd have to go to project/Build.scala and add the following setting:

scalacOptions += "-Xfatal-warnings",

[1] http://docs.scala-lang.org/overviews/reflection/typetags-manifests.html
[2] https://scalerablog.wordpress.com/2015/12/21/classtag-class-and-war-stories/

@malcolmgreaves malcolmgreaves changed the title Suggest: Add -Xfatal-warnings to build Suggest: Add -Xfatal-warnings to build Nov 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant