Skip to content

Add capture checking the compiler as a test #16292

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 38 commits into from
Nov 10, 2022
Merged
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
1d2e16e
Bugfix: generate same kind of MethodType when capture checking anonym…
odersky Nov 6, 2022
5496ef1
Bugfix: Avoid crash in cc/Synthetics
odersky Nov 6, 2022
65d8b19
Performance: Run capture checking transformers only if cc is enabled …
odersky Nov 6, 2022
2066efa
Enhancement: Revert automatic boxing of universal variable initializers
odersky Nov 6, 2022
f17fff9
Enhancement: Special treatment of arguments of `asInstanceOf`
odersky Nov 6, 2022
feb4c7c
Enhancement: Assume special capturing types for `eq` and `ne`
odersky Nov 6, 2022
96643ef
Bugfix: Allow all private definitions to have inferred types
odersky Nov 6, 2022
824580e
Bugfix: Avoid spurious check in RefChecks
odersky Nov 6, 2022
7740fb7
Bugfix: More lenient definition when an inferred type is OK for visib…
odersky Nov 6, 2022
4b98155
Enhancement: Don't count @constructorOnly parameters towards the self…
odersky Nov 6, 2022
b21867f
Enhancement: More lenient check for inferred self types
odersky Nov 6, 2022
4b97e1d
Enhancement: Add missing case for comparison of capturing types.
odersky Nov 6, 2022
7f0e259
Enhancement: Force all exception classes to be pure
odersky Nov 6, 2022
3964599
Tweak: Don't refine parameters of Java classes
odersky Nov 6, 2022
2ba6289
Tweak: Tweak rechecking of returns
odersky Nov 6, 2022
d157daa
Bugfix: Refine canWidenAbstract criterion
odersky Nov 6, 2022
18b8ff4
Tweak: Widen skolem types before conformity checks
odersky Nov 6, 2022
1b15fa6
Bugfix: Relax experimental inheritance criterion
odersky Nov 6, 2022
055beab
Enhancement: Introduce caps.Pure trait
odersky Nov 6, 2022
f194098
Tweak: Make root addition handler take a context
odersky Nov 6, 2022
f6e1c03
Bugfix: Fix setup of overriding symbols
odersky Nov 6, 2022
65477c5
Bugfix: Make another map an IdempotentCaptRefMap
odersky Nov 6, 2022
594aa1a
Bugfix: Fix handling for call-by-name arguments of applied types
odersky Nov 6, 2022
f8c4482
Bugfix: Make sure to restore anonymous function infos
odersky Nov 6, 2022
10c657c
Tweak: Exclude default getters from "must be explicitly defined" requ…
odersky Nov 7, 2022
c2086df
Enhancement: Treat Any as a top type for comparisons.
odersky Nov 7, 2022
ff5726c
Enhancement: Implement bounds checking
odersky Nov 7, 2022
25a4246
Enhancement: Take purity of classes into account when capture checking
odersky Nov 7, 2022
f079fe5
Enhancement: Add unsafeBoxFunArg operation.
odersky Nov 7, 2022
96bbc1d
Bugfix: Restore cached denotations of NamedTypes to their value befor…
odersky Nov 7, 2022
78dc699
Bugfix: Maintain inline context when rechecking
odersky Nov 7, 2022
2d5e981
Tweak: Avoid type ascription in uncheckedNN
odersky Nov 7, 2022
0381e2e
Enhancement: Move unsafe box/unbox ops into separate caps.unsafe module
odersky Nov 7, 2022
5d7b043
Tweak: Print Ranges like regular types
odersky Nov 7, 2022
f07dc95
Enhancement: Generalize handling of exceptions to all pure base classes
odersky Nov 7, 2022
bf5bb34
Add compiler as a separate test
odersky Nov 7, 2022
bca0ada
Changes to compiler codebase so that it passes capture checking
odersky Nov 7, 2022
8e9327b
Drop recheck test
odersky Nov 7, 2022
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
Prev Previous commit
Next Next commit
Enhancement: Treat Any as a top type for comparisons.
It was already implied before, but so far an explicit rule that

    cs T <: Any

was missing. Adding that rule is important for bounds checking.
  • Loading branch information
odersky committed Nov 8, 2022
commit c2086df731669081d33bb0ee9ba9c913214edefc
3 changes: 2 additions & 1 deletion compiler/src/dotty/tools/dotc/core/TypeComparer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,8 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
res

case CapturingType(parent1, refs1) =>
if subCaptures(refs1, tp2.captureSet, frozenConstraint).isOK && sameBoxed(tp1, tp2, refs1)
if tp2.isAny then true
else if subCaptures(refs1, tp2.captureSet, frozenConstraint).isOK && sameBoxed(tp1, tp2, refs1)
then recur(parent1, tp2)
else thirdTry
case tp1: AnnotatedType if !tp1.isRefining =>
Expand Down