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

Refrain from adding ctor to class from ct.sym #9

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/compiler/scala/tools/nsc/settings/ScalaSettings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ trait ScalaSettings extends StandardScalaSettings with Warnings { _: MutableSett
// TODO validate release <= java.specification.version
}
} withAbbreviation "--release"
def releaseValue: Option[String] = Option(release.value).filter(_ != "")
def releaseValue: Option[String] = Option(release.value).filter(_ != "") // release.valueSetByUser

/**
* -X "Advanced" settings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,11 @@ abstract class ClassfileParser(reader: ReusableInstance[ReusableDataReader]) {
val needsConstructor = (
!sawPrivateConstructor
&& !(instanceScope containsName nme.CONSTRUCTOR)
&& ((sflags & INTERFACE) == 0 || (sflags | JAVA_ANNOTATION) != 0)
&& ((sflags & INTERFACE) == 0 || (sflags & JAVA_ANNOTATION) != 0)
&& {
val isSig = file.name.endsWith(".sig")
!isSig
}
)
if (needsConstructor)
instanceScope enter clazz.newClassConstructor(NoPosition)
Expand Down
4 changes: 4 additions & 0 deletions test/files/neg/t12565.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
t12565.scala:5: error: java.time.Instant does not have a constructor
def f = new java.time.Instant
^
1 error
9 changes: 9 additions & 0 deletions test/files/neg/t12565.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// scalac: -Werror --release 8
// javaVersion: 9+

class C {
def f = new java.time.Instant
}
object Test extends App {
println(new C().f)
}