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

typeintersect: also record chained innervars #50551

Merged
merged 1 commit into from
Jul 16, 2023
Merged

Conversation

N5N3
Copy link
Member

@N5N3 N5N3 commented Jul 14, 2023

On master, we only record direct innervars (T -> S<:Val{T}).
And chained innervars might be ignored (T -> S<:Val{V<:T}.

Before #48228, those chained innervars would have been wrapped into an UnionAll, thus we just need to check outer vars' lb/ub.

Test added.
Note: this only fix #50456 (comment), the other MWE still get stackoverflow.

@N5N3 N5N3 added the types and dispatch Types, subtyping and method dispatch label Jul 14, 2023
@N5N3 N5N3 requested a review from vtjnash July 14, 2023 15:27
@N5N3 N5N3 changed the title Also record chained innervars typeintersect: also record chained innervars Jul 14, 2023
Copy link
Member

@vtjnash vtjnash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This make general sense to me. Do you know if this should happen later, during the vb->innervars walk, instead of immediately as done here?

Secondly, should we move this code to a helper function, so that various odd conditional difference between the code (like whether omit_bad_union should be copied here too) are visible?

@N5N3
Copy link
Member Author

N5N3 commented Jul 15, 2023

Do you know if this should happen later, during the vb->innervars walk, instead of immediately as done here?

For me it make more sense to put it here. As the most intuitive solution is:

  1. Wrapping all btemp's innervars into an UnionAll
  2. Do current direct check. And set wrap correctly.
  3. Unwrap and replace the (changed) inner vars.

@vtjnash
Copy link
Member

vtjnash commented Jul 15, 2023

That works for me then. I remember trying to do this here in that previous PR too (when I ended up adding the loop later in that previous PR), and I don't remember the exact reason I did that other approach instead for that.

At present we only record direct `innervars` (`T` -> `S<:Val{T}`). And chained `innervars` might be ignored (`T` -> `S<:Val{V<:T}`\
This commit fix it.
@N5N3 N5N3 added needs pkgeval Tests for all registered packages should be run with this change backport 1.10 Change should be backported to the 1.10 release labels Jul 15, 2023
@N5N3
Copy link
Member Author

N5N3 commented Jul 15, 2023

Looks like it's simpler to put the indirect vars check before the current direct check. (IIRC we only store the innervar in the outmost blinding.)
The omit_bad_union still needs fix, but I think we can do that in the future.

@N5N3
Copy link
Member Author

N5N3 commented Jul 15, 2023

@nanosoldier runtests()

@nanosoldier
Copy link
Collaborator

The package evaluation job you requested has completed - possible new issues were detected.
The full report is available.

@vtjnash
Copy link
Member

vtjnash commented Jul 15, 2023

@nanosoldier runtests(["Syslogs", "QuantumSavory", "ProfileEndpoints", "Pyehtim", "PyBraket", "Yunir", "OptimKit", "Plots", "DiffEqNoiseProcess", "LinearRationalExpectations", "OptimizationMetaheuristics", "DataDrivenLux", "ProgressMeter", "VoronoiFVMDiffEq", "Distances", "MCMCDiagnosticTools", "RomeoDFT", "LuaCall", "SeisMain", "QuantumSymbolics", "PowerSystemCaseBuilder", "Modia", "PowerModelsONM"])

@nanosoldier
Copy link
Collaborator

The package evaluation job you requested has completed - possible new issues were detected.
The full report is available.

@N5N3 N5N3 added this pull request to the merge queue Jul 16, 2023
Merged via the queue into JuliaLang:master with commit c22b1c1 Jul 16, 2023
@N5N3 N5N3 deleted the interfix branch July 16, 2023 12:06
KristofferC added a commit that referenced this pull request Jul 24, 2023
Backported PRs:
- [x] #50411 <!-- Fix weird dispatch of * with zero arguments -->
- [x] #50202 <!-- Remove dynamic dispatch from _wait/wait2 -->
- [x] #50064 <!-- Fix numbered prompt with input only with comment -->
- [x] #50026 <!-- Store heapsnapshot files in tempdir() instead of
current directory -->
- [x] #50402 <!-- Add CPU feature helper function -->
- [x] #50387 <!-- update newpages pointer after actually sweeping pages
-->
- [x] #50424 <!-- avoid potential type-instability in _replace_(str,
...) -->
- [x] #50444 <!-- Optimize getfield lowering to avoid boxing in some
cases -->
- [x] #50474 <!-- docs: Fix a `!!! note` which was miscapitalized -->
- [x] #50466 <!-- relax assertion involving pg->nold to reflect that it
may be a bit in… -->
- [x] #50490 <!-- Fix compat annotation for italic printstyled -->
- [x] #50488 <!-- fix typo in `Base.isassigned` with `Tridiagonal` -->
- [x] #50476 <!-- Profile: Add specifying dir for `take_heap_snapshot`
and handling if current dir is unwritable -->
- [x] #50461 <!-- fix typo in the --gcthreads argument description -->
- [x] #50528 <!-- ssair: Correctly handle stmt insertion at end of basic
block -->
- [x] #50533 <!-- ensure internal_obj_base_ptr checks whether objects
past freelist pointer are in freelist -->
- [x] #49322 <!-- improve cat design / performance -->
- [x] #50540 <!-- gc: remove over-eager assertion -->
- [x] #50542 <!-- gf: remove unnecessary assert cycle==depth -->
- [x] #50559 <!-- Expand kwcall lowering positional default check to
vararg -->
- [x] #50058 <!-- Add unwrapping mechanism for triangular mul and solves
-->
- [x] #50551 <!-- typeintersect: also record chained `innervars` -->
- [x] #50552 <!-- read(io, Char): fix read with too many leading ones
-->
- [x] #50541 <!-- precompile: ensure globals are not accidentally
created where disallowed -->
- [x] #50576 <!-- use atomic compare exchange when setting the GC
mark-bit -->
- [x] #50578 <!-- gf: make method overwrite/delete an error during
precompile -->
- [x] #50516 <!-- Fix visibility of assert on GCC12/13 -->
- [x] #50597 <!-- Fix memory corruption if task is launched inside
finalizer -->
- [x] #50591 <!-- build: fix various makefile bugs -->
- [x] #50599 <!-- faster invalid object lookup in conservative gc -->
- [x] #50634 <!-- 🤖 [master] Bump the SparseArrays stdlib from b4b0e72
to 99c99b4 -->
- [x] #50639 <!-- Backport LLVM patches to fix various issues. -->
- [x] #50546 <!-- Revert storage of method instance in LineInfoNode -->
- [x] #50631 <!-- Shift DCE pass to optimize imaging mode code better
-->
- [x] #50525 <!-- only check that values are finite in `generic_lufact`
when `check=true` -->
- [x] #50587 <!-- isassigned for ranges with BigInt indices -->
- [x] #50144 <!-- Page based heap size heuristics -->


Need manual backport:
- [ ] #50595 <!-- Rename ENV variable `JULIA_USE_NEW_PARSER` ->
`JULIA_USE_FLISP_PARSER` -->



Non-merged PRs with backport label:
- [ ] #50637 <!-- Remove SparseArrays legacy code -->
- [ ] #50618 <!-- inference: continue const-prop' when concrete-eval
returns non-inlineable -->
- [ ] #50598 <!-- only limit types in stack traces in the REPL -->
- [ ] #50594 <!-- Disallow non-index Integer types in isassigned -->
- [ ] #50568 <!-- `Array(::AbstractRange)` should return an `Array` -->
- [ ] #50523 <!-- Avoid generic call in most cases for getproperty -->
- [ ] #50172 <!-- print feature flags used for matching pkgimage -->
@KristofferC KristofferC removed the backport 1.10 Change should be backported to the 1.10 release label Jul 24, 2023
@N5N3 N5N3 removed the needs pkgeval Tests for all registered packages should be run with this change label Aug 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
types and dispatch Types, subtyping and method dispatch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New Internal error: stack overflow in type inference when testing some packages
4 participants