Skip to content

Alt fix for #13701 #13704

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

Merged
merged 2 commits into from
Oct 7, 2021
Merged
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
9 changes: 5 additions & 4 deletions compiler/src/dotty/tools/dotc/core/SymDenotations.scala
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,11 @@ object SymDenotations {
if (myFlags.is(Trait)) NoInitsInterface & bodyFlags // no parents are initialized from a trait
else NoInits & bodyFlags & parentFlags)

private def isCurrent(fs: FlagSet) =
fs <= (
if (myInfo.isInstanceOf[SymbolLoader]) FromStartFlags
else AfterLoadFlags)
def isCurrent(fs: FlagSet)(using Context): Boolean =
def knownFlags(info: Type): FlagSet = info match
case _: SymbolLoader | _: ModuleCompleter => FromStartFlags
case _ => AfterLoadFlags
!myInfo.isInstanceOf[LazyType] || fs <= knownFlags(myInfo)

final def relevantFlagsFor(fs: FlagSet)(using Context) =
if (isCurrent(fs)) myFlags else flags
Expand Down
16 changes: 16 additions & 0 deletions compiler/test/dotty/tools/repl/JavaDefinedTests.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package dotty.tools.repl

import org.junit.Assert._
import org.junit.Test

class JavaDefinedTests extends ReplTest {
@Test def typeOfJavaDefinedString = fromInitialState { implicit s =>
run("String")
assertTrue(storedOutput().contains("Java defined class String is not a value"))
}

@Test def typeOfJavaDefinedClass = fromInitialState { implicit s =>
run("Class")
assertTrue(storedOutput().contains("Java defined class Class is not a value"))
}
}
2 changes: 2 additions & 0 deletions tests/neg/i13701.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@main def Test() = String // error