Skip to content

Commit

Permalink
ast: fix check-condition failure in This.resolveTypes
Browse files Browse the repository at this point in the history
fixes #3371
  • Loading branch information
michaellilltokiwa committed Jul 12, 2024
1 parent dbec0af commit b5d4313
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 1 deletion.
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

0 comments on commit b5d4313

Please sign in to comment.