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

ast: fix check-condition failure in This.resolveTypes #3373

Merged
merged 1 commit into from
Jul 15, 2024
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
2 changes: 1 addition & 1 deletion src/dev/flang/ast/This.java
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ else if (f.isUniverse())
*/
var cur = _cur == null ? outer : _cur;
getOuter = new Current(pos(), cur);
while (f != Types.f_ERROR && cur != f)
while (f != Types.f_ERROR && cur != f && !cur.isUniverse())
{
var or = cur.outerRef();
if (CHECKS) check
Expand Down
25 changes: 25 additions & 0 deletions tests/reg_issue3371/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# This file is part of the Fuzion language implementation.
#
# The Fuzion language implementation is free software: you can redistribute it
# and/or modify it under the terms of the GNU General Public License as published
# by the Free Software Foundation, version 3 of the License.
#
# The Fuzion language implementation is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
# License for more details.
#
# You should have received a copy of the GNU General Public License along with The
# Fuzion language implementation. If not, see <https://www.gnu.org/licenses/>.


# -----------------------------------------------------------------------
#
# Tokiwa Software GmbH, Germany
#
# Source code of Fuzion test Makefile
#
# -----------------------------------------------------------------------

override NAME = reg_issue3371
include ../simple.mk
27 changes: 27 additions & 0 deletions tests/reg_issue3371/reg_issue3371.fz
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This file is part of the Fuzion language implementation.
#
# The Fuzion language implementation is free software: you can redistribute it
# and/or modify it under the terms of the GNU General Public License as published
# by the Free Software Foundation, version 3 of the License.
#
# The Fuzion language implementation is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
# License for more details.
#
# You should have received a copy of the GNU General Public License along with The
# Fuzion language implementation. If not, see <https://www.gnu.org/licenses/>.


# -----------------------------------------------------------------------
#
# Tokiwa Software GmbH, Germany
#
# Source code of Fuzion test
#
# -----------------------------------------------------------------------

a := [("Alice", 23), ("Bob", 12), ("Charly", 32)]
age_sum := a.map (p -> p.1) |> sum
count := a.map (p -> 1) |> sum
say "average age {age_sum / count}"
Empty file.
1 change: 1 addition & 0 deletions tests/reg_issue3371/reg_issue3371.fz.expected_out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
average age 22