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

"match may not be exhaustive" from synthetic code #12602

Closed
lrytz opened this issue May 25, 2021 · 5 comments · Fixed by #12549
Closed

"match may not be exhaustive" from synthetic code #12602

lrytz opened this issue May 25, 2021 · 5 comments · Fixed by #12549

Comments

@lrytz
Copy link
Member

lrytz commented May 25, 2021

sealed class Foo[T]
object Foo extends Foo[Nothing]

gives

result of Test.scala after MegaPhase{firstTransform, checkReentrant, elimPackagePrefixes, cookComments, checkStatic, betaReduce, inlineVals, expandSAMs}:
package <empty> {
  @scala.annotation.internal.SourceFile("Test.scala") @
    scala.annotation.internal.Child
  [Foo.type]() sealed class Foo[T]() extends Object() {
    T
  }
  final lazy module val Foo: Foo$ = new Foo$()
  @scala.annotation.internal.SourceFile("Test.scala") final module class Foo$()
     extends
   Foo[Nothing](), scala.deriving.Mirror.Sum {
    private def writeReplace(): AnyRef =
      new scala.runtime.ModuleSerializationProxy(classOf[Foo.type])
    type MirroredMonoType = Foo[? <: AnyKind]
    def ordinal(x$0: Foo.MirroredMonoType): Int =
      x$0 match
        {
          case _:Foo.type => 0
        }
  }
}
result of Test.scala after MegaPhase{elimRepeated, protectedAccessors, extmethods, uncacheGivenAliases, byNameClosures, hoistSuperArgs, specializeApplyMethods, refchecks}:
  Unchanged since MegaPhase{firstTransform, checkReentrant, elimPackagePrefixes, cookComments, checkStatic, betaReduce, inlineVals, expandSAMs}
-- [E029] Pattern Match Exhaustivity Warning: Test.scala:1:28 ------------------
1 |sealed class Foo[T]; object Foo extends Foo[Nothing]
  |                            ^
  |                            match may not be exhaustive.
  |
  |                            It would fail on pattern case: _: Foo[_]
liufengyun added a commit to dotty-staging/dotty that referenced this issue May 25, 2021
@liufengyun liufengyun self-assigned this May 25, 2021
@liufengyun
Copy link
Contributor

Thanks for the report @lrytz , it's now fixed in 37f4855 as part of #12549.

@lrytz
Copy link
Member Author

lrytz commented May 25, 2021

Great, thank you!

@liufengyun
Copy link
Contributor

Actually, the fix is incorrect and the warning is correct: because Foo is not abstract, we can create an instance of Foo, it will not be matched by Foo.type.

liufengyun added a commit to dotty-staging/dotty that referenced this issue May 25, 2021
@liufengyun liufengyun linked a pull request May 25, 2021 that will close this issue
liufengyun added a commit to dotty-staging/dotty that referenced this issue May 25, 2021
@lrytz
Copy link
Member Author

lrytz commented May 26, 2021

... right.

But then the synthetic ordinal method is incomplete, isn't it?

Why is ordinal generated in the first place?

@liufengyun
Copy link
Contributor

But then the synthetic ordinal method is incomplete, isn't it?

Why is ordinal generated in the first place?

Indeed, the typeclass derivation code should not be generated in the first place. We miss a condition somewhere.

liufengyun added a commit to dotty-staging/dotty that referenced this issue May 26, 2021
EnzeXing added a commit to EnzeXing/dotty that referenced this issue Jun 11, 2021
Add tests

Add tests

Add tests

Update Desugar.scala

Update InteractiveDriver.scala

Update closureLeak.scala

Update default-this.scala

Update enum.scala

Update leak-this-inner.scala

Update leak-this.scala

Update leak-warm.scala

Update local-warm.scala

updated test cases

updated-default-this

updated tests

Add tests for cycle structure

Add desugared version for enum.scala

Update Desugar.scala

Update InteractiveDriver.scala

Update closureLeak.scala

Update default-this.scala

Update enum.scala

Update leak-this-inner.scala

Update leak-this.scala

Update leak-warm.scala

Update local-warm.scala

Comment Typo Fix in Concat

Correctly check experimental features

- When inlining: emit "experimental" error only when
  the feature in question is actually annotated as
  experimental
- Compiler-wide: treat non-bootstrapped compiler as
  experimental-friendly. The motivation is to compile
  the standard library with experimental features enabled
  at all times. This change isn't supposed to introduce any
  experimental features leaks into stable builds since
  we do not publish non-bootstrapped compiler.

Fix scala#12128: Add test

Don't force info to get signature in TreeChecker

When we are reading a new definition from tasty and setting `info` of
a symbol in `readNewDef`:

          sym.info = methodType(paramss, resType)

The line above will reach `TreeChecker.transformSym`:

          assert(symd.signature == initial.signature

At the time, the `symd` is not yet completed. Getting signature of the
denotation will force the symbol and trigger completion of the info,
which reaches the `PositionTree` in `readIndexedDef.

Fix regression test for scala#12128

To properly reproduce scala#12128, the regression test has some atypical
classpath requirements in addition to separate compilation.

Snippet compiler PoC

Reporter fix. Message levels

Fix snippet wrapper. Integrate snippet checker with Wiki and Markdown renderers

Further implementation of snippet compiler. Add package name and self type to pass context

Add arguments to control snippet compiler.

Start work on handling hide directives in code snippets

Hide irrelevant code snippet fragments in scaladoc

Apply review suggestions from PR scala#11822

Add returning real line of error in source file of snippet for snippet scaladoc compiler

Add failing flag

Add debug flag.

Add addition operation for snippet compiler arg

Refactor snippet compiler args

Move snippet compiler logic to parsing phase.

Refactor debug flag

Display snippet compilation messages in scaladoc

Apply review changes

Run snippet compiler on static sites

Further enhancements of snippet contexts

Filter non-scala snippets. Report errors in parsing override flags

Fix positions in static sites. Enchance snippet wrapping

CRs

Add and update tests for snippet compiler. Bugfixes found during testing

Wrap compiler messages into Try block to avoid lazy exceptions

Update branch

Fix classpath problems. Add support for scala.js. Add bootclasspath to generateDocumentation task

Temporarily turn off snippet checking for scala3 library

Change requests from reviews

Scala2Unpickler: Don't trust the owner field of tparams

When a type parameter of a class external to the current pickle is
referenced, Scala 2 will sometimes pickle it as if it was a type
parameter of the current class. When we unpickle such a type parameter
on our side, we enter it in the class, this leads the compiler to
believe the class has more type parameters than it actually has. This
doesn't happen in Scala 2 itself because it never enters unpickled type
parameters in the class that owns them (it must be recreating them in
some way, but I don't know how).

It would be interesting to dig deeper to understand exactly how Scala 2
handles type parameter unpickling so we could emulate it given that this
is not the first time we run into trouble here (cf scala#12120), but for now
we fix the problem with the following heuristic: once we've loaded all
the type parameters of a class (which we do eagerly via
`ClassUnpickler#init()`), we simply stop from being entered any
subsequent type parameter we see for this class. Time will tell if this
is good enough.

While I was touching that code, I also made
ClassCompleter#completerTypeParams idempotent as one would expect it to
be.

Fixes scala#12641.

Preserve hard unions in more situations

There's multiple places where we take apart a union, apply some
transformation to its parts, then either return the original union if
nothing changed or recombine the transformed parts into a new union. The
problem is that to check if nothing changed we use referential equality
when `=:=` would be more correct, so we sometimes end up returning a
union equivalent to the original one except the new one is a soft union.

I've seen this lead to subtle type inference differences both when
experimenting with changes to constraint solving and when trying to
replace our Uniques hashmaps by weak hashmaps.

We could fix this by replacing these `eq` calls by `=:=` but instead
this commit takes the approach of preserving the softness of a union
even when its components are modified, see the test case.

Fix implicit ValueOf synthesis

Foxes scala#12583

Fix hole in scan for outer references

Type tests of singletons need to be considered as well.

Fix typo in syntax.md

The supertype symbol was ':>' and it was changed to '>:' .

Always generate a partial function from a lambda

`scalac` no longer complains, neither should `dotc`. I verified that
the output of `i4241.scala` is the same for both `scalac` and `dotc`.

Fixes scala#12661

drop unused code

Fix test name

Extract the function type and SAM in union type (scala#11760)

Fixes scala#11694.

forbid given patterns in val definitions.

Suggest that they use an alias
given instead.

Fix scala#12544: Add test

Add neg test

Harden type comparer in presence of kind errors

It should not crash when an override has the wrong kind.

Fixes scala#12664

Fix scala#12546: Handle enum or object in provablyDisjoint

A enum or object is provably disjoint with a class A if the module
class does not derive from A.

Better support type-heavy pattern matches

Avoid type cast

Fix unreachable code

Fix CI

Handle enums that have multiple parents

Fix scala#12559: Try decomposable types in isSubspace

Fix scala#12602: Only generate sum mirrors for sealed trait or sealed abstract class

Fix scala#12681: Approximate `ThisType` in child instantiation

Fix master: Remove test

We will add the test again with a new PR

fix scala#12634 - port sbt/zinc#979

Add sealedDescendants method to
SymDenotation - recursive children
of a symbol

Add Matchable to the parents of Null in explicit nulls

Add icons for all members. Add icons for search results.

Re-enable the Scala.js test JSOptionalTest212FunParamInference.

The issue scala#11694, which prevented this test from compiling, was
fixed in scala#11760.

Bump compiler version to the next one – 3.0.2-RC1

fix scala#12401: mangle ctor names in ExtractAPI

Avoid assertion failure when forcing LazyRef while printing

Fixes scala#12650

The fix that matters for scala#12650 is the one in Checking. The others generally increase
robustness of printing diagnostics when triggering a LazyRef recursion.

Drop flaky test

Fixes scala#12693

Deskolemize PatternTypeConstrainer

Before this commit, constrainSimplePatternType did a bunch of manipulations and
then ran a subtype check. It wrapped one of the types in a SkolemType and
replaces type arguments of the other one with wildcards. The point of those
manipulations was to make TypeComparer take a specific path and compare
appropriate subcomponents of constrainSimplePatternType's arguments. This turned
out to be a problem overall. To improve the situation, we instead manually
compare the appropriate subcomponents of constrainSimplePatternType - the
changes can be seen as inlining pieces of code from TypeComparer.

Also, this commit adds restoring the GADT constraint to TypeComparer - this
turned out to be more important now that constrainSimplePatternType now does
multiple isSubType checks.

Fix failing test

Add explanatory comments

Adjust comments

Insert conversions also on selections wrapped in type applications

In i12708.scala, the problematic function was a selection `qual.m[tvs]` that was already
applied to type variables. In that case we need to backtrack, forget the type variables
and try to insert a conversion or extension method on `qual`.

Fixes scala#12708

Fix tests

Add 3.0.1-RC1 blog article

Remove experimental macro feature mention

Co-authored-by: Nicolas Stucki <nicolas.stucki@gmail.com>

macros.md: fix parentheses/braces in inlined Macros.assert() example

The parantheses and braces where swapped. Also align the style with
the follow up example to make it easier to spot the differences.

Add regression test for scala#12723

Deleted unnecessary explanations

As a result of replacing 'Dotty' with 'Scala 3' in the following commit,
the explanation 'which is scheduled to become Scala 3' is no longer needed.

scala@ccb76da

Improve display of references for ambiguous implicit errors

If the first attempt yields equal strings, print the full path to the implicits instead.

Fixes scala#12591

Reclassify test

Add check file

Improvements to search UX

Pressing "S" while not focused on an input/textarea will now open the search.
Pressing "F" while not focused on an input/textarea will focus the member filter input.
Pressing Escape while focused on the search/filter will clear the input and close/unfocus it
Search result links are now treated as block elements so you can click anywhere inside the rectangle rather than specifically on the result text.

also allow '/' to trigger the search

Add browsable versions extension for scaladoc

Change local storage to session storage, fix bugs with undefined js variable

Chagne try catching of undefined scalajs property to js.typeOf

Add test for infix operator usage from Scala 2 libraries

Fixes scala#7304

Preserve tvar instantiation in implicit error messages

make default colors less harsh, add dark/light theme swapper

make dottydoc anchors transparent instead of white when not hovered

infer dark theme preference from user's system

add some 'missing' semicolons to some JS

set min-width on the theme switch so it doesn't get squished

Make dark-mode footer actually dark. Improve contrast/accessibility.

Used the "poor man's dark mode" approach to deal with the images in the
footer in dark mode, i.e. invert and hue rotate (without the hue rotate,
the red scala3doc logo becomes blue)

Also fix an issue where if you click "back to top" and then refresh the
page, the "container" element gains the "expand" class, which causes
the main signature (i.e. `class List[A] ...`) to become 'inline' instead
of a block, and it also triggers the 6.5em left-margin that's intended
for method signatures when they get expanded.

Also consolidated the `footer` styles, since they were spread all over.

Check CLA for user who opened pull request, not workflow initiator

Add regression test

Closes scala#12754

Don't allow wildcard types in constraints

Fixes scala#12677

Only drop wildcards for necesessary comparisons

Wildcards in constraints essentially mean that the constrained
variable is a sub/supertype of _every_ instance of the bound. For
useNecesaryEither, this is wrong. Approximate the bound not to
use wildcards instead.

drop all kinds of WildcardType under useNecessaryEither

better bounds for wildcards in resultTypeApprox

Avoid wildcard types in constraints

Ther semantics is fishy. Instead, use avoidance in necessarySubType
and in TypeVarsMiss context mode, and use fresh type variables elsehwere.

Cleanup addOneBound logic

Verify that constraints do not contain wildcard types

Cleanups

Streamline approximateWildcards logic

Test assertion

Don't let wildcards enter constraints when adding type lambdas

Fix typo

Turn off "no wildcards in constraint" check

Address review comments

macros.md: Fix htmlized variant of first source code example

Confusingly, the last part of the first source code example would
appear as

def showExpr(expr: Expr[Boolean])(using Quotes): Expr[String] =
  '{ "

         " }

in the htmlized version of the markdown documentation source. Which
reads as follows:

def showExpr(expr: Expr[Boolean])(using Quotes): Expr[String] =
  '{ "<some source code>" } // Better implementation later in this document

This seems to be cause by the usage of angle brackets. Also note that
the code comment does not appear in the htmlized output.

Fix typo in 3.0.1-RC1 release notes

Fix scala#9588: Enable Scala.js test ObjectTest.

The issue preventing that test from compiling in the past was
fixed, although we don't know when or by what.

Scala.js: Mangle test names when generating JUnit bootstrappers.

This fixes the last remaining JUnit-related tests, which we
therefore enable.

Copy old site versions for Scala 3 instead of Dotty 0.X

Support both 0.X and 3.X lines

For extension label, avoid scala style

Fix escaping illegal tokens in snippet renderer in scaladoc

Use sbt makeScalaInstance

Add definition

Add doc for env

Fix compilation

Refactor trace

Support Value.source for friendly error message

Disallow non-hot arguments to non-constructors

Handle access of parameters in constructors

Handle exception

No exceptions

Fix Env.isHot

Add missing checks for arguments

Handle new expression with only cold args

Fix soundness test

Reorganize tests

Add test

Add test for secondary constructor

Refactor promotion

Add test

More logging

Fix bug with promotion of this

The previous code does not work, because private fields are not included.

Refactor code: introduce ArgInfo instead of Value.source

Handle O.this outside of it's definition

Fix owner of values with static flag

With the flag <static>, the enclosing class will be skipped.
See the documentation `SymDenotation.enclosingClass`

Add documentation about caching

Add test

Add another neg test for promotion of ThisRef

Handle outers of trait as the same in concrete semantics

For traits, its outers will be proxy methods of the class that extends
the trait. As the prefix is stable and is a valid value before any
super constructor calls. Therefore, we may think the outers for traits
are immediately set following the class parameters.

Also, when trying promotion of warm values, we never try warm values
whose fields are not fully filled -- which corresponds to promote
ThisRef with non-initialized fields, and errors will be reported when
the class is checked separately.

Address review (thanks @michelou)

Rename isFullyInitialized to isFullyFilled to avoid confusion

 Restrict function arguments to be hot

This aligns with the design of restricting method arguments to be hot.
We only allow non-hot to constructors.

Add documentation

Address review

Simplify logic for checking local classes inside secondary constructors

Address review: simplify logic

Abstract parameters of non-local constructor parameters as cold

This is a simple fix which should have no impact on expressiveness
and usability, as local classes inside secondary constructors are
extremely rare.

Update docs

Fix scala#11973: Add regression test

community build: Update munit

Add Libretto to community build.

re-organize tests
EnzeXing added a commit to EnzeXing/dotty that referenced this issue Jun 11, 2021
Add tests

Add tests

Add tests

Update Desugar.scala

Update InteractiveDriver.scala

Update closureLeak.scala

Update default-this.scala

Update enum.scala

Update leak-this-inner.scala

Update leak-this.scala

Update leak-warm.scala

Update local-warm.scala

updated test cases

updated-default-this

updated tests

Add tests for cycle structure

Add desugared version for enum.scala

Update Desugar.scala

Update InteractiveDriver.scala

Update closureLeak.scala

Update default-this.scala

Update enum.scala

Update leak-this-inner.scala

Update leak-this.scala

Update leak-warm.scala

Update local-warm.scala

Comment Typo Fix in Concat

Correctly check experimental features

- When inlining: emit "experimental" error only when
  the feature in question is actually annotated as
  experimental
- Compiler-wide: treat non-bootstrapped compiler as
  experimental-friendly. The motivation is to compile
  the standard library with experimental features enabled
  at all times. This change isn't supposed to introduce any
  experimental features leaks into stable builds since
  we do not publish non-bootstrapped compiler.

Fix scala#12128: Add test

Don't force info to get signature in TreeChecker

When we are reading a new definition from tasty and setting `info` of
a symbol in `readNewDef`:

          sym.info = methodType(paramss, resType)

The line above will reach `TreeChecker.transformSym`:

          assert(symd.signature == initial.signature

At the time, the `symd` is not yet completed. Getting signature of the
denotation will force the symbol and trigger completion of the info,
which reaches the `PositionTree` in `readIndexedDef.

Fix regression test for scala#12128

To properly reproduce scala#12128, the regression test has some atypical
classpath requirements in addition to separate compilation.

Snippet compiler PoC

Reporter fix. Message levels

Fix snippet wrapper. Integrate snippet checker with Wiki and Markdown renderers

Further implementation of snippet compiler. Add package name and self type to pass context

Add arguments to control snippet compiler.

Start work on handling hide directives in code snippets

Hide irrelevant code snippet fragments in scaladoc

Apply review suggestions from PR scala#11822

Add returning real line of error in source file of snippet for snippet scaladoc compiler

Add failing flag

Add debug flag.

Add addition operation for snippet compiler arg

Refactor snippet compiler args

Move snippet compiler logic to parsing phase.

Refactor debug flag

Display snippet compilation messages in scaladoc

Apply review changes

Run snippet compiler on static sites

Further enhancements of snippet contexts

Filter non-scala snippets. Report errors in parsing override flags

Fix positions in static sites. Enchance snippet wrapping

CRs

Add and update tests for snippet compiler. Bugfixes found during testing

Wrap compiler messages into Try block to avoid lazy exceptions

Update branch

Fix classpath problems. Add support for scala.js. Add bootclasspath to generateDocumentation task

Temporarily turn off snippet checking for scala3 library

Change requests from reviews

Scala2Unpickler: Don't trust the owner field of tparams

When a type parameter of a class external to the current pickle is
referenced, Scala 2 will sometimes pickle it as if it was a type
parameter of the current class. When we unpickle such a type parameter
on our side, we enter it in the class, this leads the compiler to
believe the class has more type parameters than it actually has. This
doesn't happen in Scala 2 itself because it never enters unpickled type
parameters in the class that owns them (it must be recreating them in
some way, but I don't know how).

It would be interesting to dig deeper to understand exactly how Scala 2
handles type parameter unpickling so we could emulate it given that this
is not the first time we run into trouble here (cf scala#12120), but for now
we fix the problem with the following heuristic: once we've loaded all
the type parameters of a class (which we do eagerly via
`ClassUnpickler#init()`), we simply stop from being entered any
subsequent type parameter we see for this class. Time will tell if this
is good enough.

While I was touching that code, I also made
ClassCompleter#completerTypeParams idempotent as one would expect it to
be.

Fixes scala#12641.

Preserve hard unions in more situations

There's multiple places where we take apart a union, apply some
transformation to its parts, then either return the original union if
nothing changed or recombine the transformed parts into a new union. The
problem is that to check if nothing changed we use referential equality
when `=:=` would be more correct, so we sometimes end up returning a
union equivalent to the original one except the new one is a soft union.

I've seen this lead to subtle type inference differences both when
experimenting with changes to constraint solving and when trying to
replace our Uniques hashmaps by weak hashmaps.

We could fix this by replacing these `eq` calls by `=:=` but instead
this commit takes the approach of preserving the softness of a union
even when its components are modified, see the test case.

Fix implicit ValueOf synthesis

Foxes scala#12583

Fix hole in scan for outer references

Type tests of singletons need to be considered as well.

Fix typo in syntax.md

The supertype symbol was ':>' and it was changed to '>:' .

Always generate a partial function from a lambda

`scalac` no longer complains, neither should `dotc`. I verified that
the output of `i4241.scala` is the same for both `scalac` and `dotc`.

Fixes scala#12661

drop unused code

Fix test name

Extract the function type and SAM in union type (scala#11760)

Fixes scala#11694.

forbid given patterns in val definitions.

Suggest that they use an alias
given instead.

Fix scala#12544: Add test

Add neg test

Harden type comparer in presence of kind errors

It should not crash when an override has the wrong kind.

Fixes scala#12664

Fix scala#12546: Handle enum or object in provablyDisjoint

A enum or object is provably disjoint with a class A if the module
class does not derive from A.

Better support type-heavy pattern matches

Avoid type cast

Fix unreachable code

Fix CI

Handle enums that have multiple parents

Fix scala#12559: Try decomposable types in isSubspace

Fix scala#12602: Only generate sum mirrors for sealed trait or sealed abstract class

Fix scala#12681: Approximate `ThisType` in child instantiation

Fix master: Remove test

We will add the test again with a new PR

fix scala#12634 - port sbt/zinc#979

Add sealedDescendants method to
SymDenotation - recursive children
of a symbol

Add Matchable to the parents of Null in explicit nulls

Add icons for all members. Add icons for search results.

Re-enable the Scala.js test JSOptionalTest212FunParamInference.

The issue scala#11694, which prevented this test from compiling, was
fixed in scala#11760.

Bump compiler version to the next one – 3.0.2-RC1

fix scala#12401: mangle ctor names in ExtractAPI

Avoid assertion failure when forcing LazyRef while printing

Fixes scala#12650

The fix that matters for scala#12650 is the one in Checking. The others generally increase
robustness of printing diagnostics when triggering a LazyRef recursion.

Drop flaky test

Fixes scala#12693

Deskolemize PatternTypeConstrainer

Before this commit, constrainSimplePatternType did a bunch of manipulations and
then ran a subtype check. It wrapped one of the types in a SkolemType and
replaces type arguments of the other one with wildcards. The point of those
manipulations was to make TypeComparer take a specific path and compare
appropriate subcomponents of constrainSimplePatternType's arguments. This turned
out to be a problem overall. To improve the situation, we instead manually
compare the appropriate subcomponents of constrainSimplePatternType - the
changes can be seen as inlining pieces of code from TypeComparer.

Also, this commit adds restoring the GADT constraint to TypeComparer - this
turned out to be more important now that constrainSimplePatternType now does
multiple isSubType checks.

Fix failing test

Add explanatory comments

Adjust comments

Insert conversions also on selections wrapped in type applications

In i12708.scala, the problematic function was a selection `qual.m[tvs]` that was already
applied to type variables. In that case we need to backtrack, forget the type variables
and try to insert a conversion or extension method on `qual`.

Fixes scala#12708

Fix tests

Add 3.0.1-RC1 blog article

Remove experimental macro feature mention

Co-authored-by: Nicolas Stucki <nicolas.stucki@gmail.com>

macros.md: fix parentheses/braces in inlined Macros.assert() example

The parantheses and braces where swapped. Also align the style with
the follow up example to make it easier to spot the differences.

Add regression test for scala#12723

Deleted unnecessary explanations

As a result of replacing 'Dotty' with 'Scala 3' in the following commit,
the explanation 'which is scheduled to become Scala 3' is no longer needed.

scala@ccb76da

Improve display of references for ambiguous implicit errors

If the first attempt yields equal strings, print the full path to the implicits instead.

Fixes scala#12591

Reclassify test

Add check file

Improvements to search UX

Pressing "S" while not focused on an input/textarea will now open the search.
Pressing "F" while not focused on an input/textarea will focus the member filter input.
Pressing Escape while focused on the search/filter will clear the input and close/unfocus it
Search result links are now treated as block elements so you can click anywhere inside the rectangle rather than specifically on the result text.

also allow '/' to trigger the search

Add browsable versions extension for scaladoc

Change local storage to session storage, fix bugs with undefined js variable

Chagne try catching of undefined scalajs property to js.typeOf

Add test for infix operator usage from Scala 2 libraries

Fixes scala#7304

Preserve tvar instantiation in implicit error messages

make default colors less harsh, add dark/light theme swapper

make dottydoc anchors transparent instead of white when not hovered

infer dark theme preference from user's system

add some 'missing' semicolons to some JS

set min-width on the theme switch so it doesn't get squished

Make dark-mode footer actually dark. Improve contrast/accessibility.

Used the "poor man's dark mode" approach to deal with the images in the
footer in dark mode, i.e. invert and hue rotate (without the hue rotate,
the red scala3doc logo becomes blue)

Also fix an issue where if you click "back to top" and then refresh the
page, the "container" element gains the "expand" class, which causes
the main signature (i.e. `class List[A] ...`) to become 'inline' instead
of a block, and it also triggers the 6.5em left-margin that's intended
for method signatures when they get expanded.

Also consolidated the `footer` styles, since they were spread all over.

Check CLA for user who opened pull request, not workflow initiator

Add regression test

Closes scala#12754

Don't allow wildcard types in constraints

Fixes scala#12677

Only drop wildcards for necesessary comparisons

Wildcards in constraints essentially mean that the constrained
variable is a sub/supertype of _every_ instance of the bound. For
useNecesaryEither, this is wrong. Approximate the bound not to
use wildcards instead.

drop all kinds of WildcardType under useNecessaryEither

better bounds for wildcards in resultTypeApprox

Avoid wildcard types in constraints

Ther semantics is fishy. Instead, use avoidance in necessarySubType
and in TypeVarsMiss context mode, and use fresh type variables elsehwere.

Cleanup addOneBound logic

Verify that constraints do not contain wildcard types

Cleanups

Streamline approximateWildcards logic

Test assertion

Don't let wildcards enter constraints when adding type lambdas

Fix typo

Turn off "no wildcards in constraint" check

Address review comments

macros.md: Fix htmlized variant of first source code example

Confusingly, the last part of the first source code example would
appear as

def showExpr(expr: Expr[Boolean])(using Quotes): Expr[String] =
  '{ "

         " }

in the htmlized version of the markdown documentation source. Which
reads as follows:

def showExpr(expr: Expr[Boolean])(using Quotes): Expr[String] =
  '{ "<some source code>" } // Better implementation later in this document

This seems to be cause by the usage of angle brackets. Also note that
the code comment does not appear in the htmlized output.

Fix typo in 3.0.1-RC1 release notes

Fix scala#9588: Enable Scala.js test ObjectTest.

The issue preventing that test from compiling in the past was
fixed, although we don't know when or by what.

Scala.js: Mangle test names when generating JUnit bootstrappers.

This fixes the last remaining JUnit-related tests, which we
therefore enable.

Copy old site versions for Scala 3 instead of Dotty 0.X

Support both 0.X and 3.X lines

For extension label, avoid scala style

Fix escaping illegal tokens in snippet renderer in scaladoc

Use sbt makeScalaInstance

Add definition

Add doc for env

Fix compilation

Refactor trace

Support Value.source for friendly error message

Disallow non-hot arguments to non-constructors

Handle access of parameters in constructors

Handle exception

No exceptions

Fix Env.isHot

Add missing checks for arguments

Handle new expression with only cold args

Fix soundness test

Reorganize tests

Add test

Add test for secondary constructor

Refactor promotion

Add test

More logging

Fix bug with promotion of this

The previous code does not work, because private fields are not included.

Refactor code: introduce ArgInfo instead of Value.source

Handle O.this outside of it's definition

Fix owner of values with static flag

With the flag <static>, the enclosing class will be skipped.
See the documentation `SymDenotation.enclosingClass`

Add documentation about caching

Add test

Add another neg test for promotion of ThisRef

Handle outers of trait as the same in concrete semantics

For traits, its outers will be proxy methods of the class that extends
the trait. As the prefix is stable and is a valid value before any
super constructor calls. Therefore, we may think the outers for traits
are immediately set following the class parameters.

Also, when trying promotion of warm values, we never try warm values
whose fields are not fully filled -- which corresponds to promote
ThisRef with non-initialized fields, and errors will be reported when
the class is checked separately.

Address review (thanks @michelou)

Rename isFullyInitialized to isFullyFilled to avoid confusion

 Restrict function arguments to be hot

This aligns with the design of restricting method arguments to be hot.
We only allow non-hot to constructors.

Add documentation

Address review

Simplify logic for checking local classes inside secondary constructors

Address review: simplify logic

Abstract parameters of non-local constructor parameters as cold

This is a simple fix which should have no impact on expressiveness
and usability, as local classes inside secondary constructors are
extremely rare.

Update docs

Fix scala#11973: Add regression test

community build: Update munit

Add Libretto to community build.

re-organize tests
@Kordyjan Kordyjan added this to the 3.0.2 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants