Skip to content

Commit e99b65a

Browse files
committed
Fix ICE on malformed interface-interface unification
1 parent 1bee857 commit e99b65a

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

clear_fixed_panics.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
#!/bin/bash
2-
# Usage: ./clear_fixed_panics.sh /path/to/crash_dumps
2+
# Usage: ./clear_fixed_panics.sh /path/to/sus_home
3+
# Must contain a subdirectory crash_dumps
34

45
if [ "$#" -ne 1 ]; then
5-
echo "Usage: $0 <crash_dumps_directory>"
6+
echo "Usage: $0 <sus_home_directory>"
67
exit 1
78
fi
89

9-
CRASHDUMPS_DIR="$1"
10+
SUS_HOME="$1"
1011
cargo build
1112
SUS_COMPILER="/home/lennart/Desktop/sus-compiler/target/debug/sus_compiler"
1213

13-
if [ ! -d "$CRASHDUMPS_DIR" ]; then
14-
echo "Directory $CRASHDUMPS_DIR does not exist."
14+
if [ ! -d "$SUS_HOME/crash_dumps" ]; then
15+
echo "Directory $SUS_HOME/crash_dumps does not exist."
1516
exit 1
1617
fi
1718

18-
for dump in "$CRASHDUMPS_DIR"/*; do
19+
for dump in "$SUS_HOME"/crash_dumps/*; do
1920
[ -d "$dump" ] || continue
2021
echo "Checking $dump..."
2122

src/to_string.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1116,7 +1116,7 @@ impl SubModule {
11161116
} else {
11171117
write!(
11181118
f,
1119-
"module {}: /* Some parameters unknown */",
1119+
"module {}: /* Could not instantiate */",
11201120
self.refers_to.display(globals)
11211121
)
11221122
}

src/typing/type_inference.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,15 @@ impl HindleyMilner for AbstractInnerType {
358358

359359
UnifyResult::Success
360360
} // Already covered by get_hm_info
361-
(_, _) => unreachable!("All others should have been eliminated by get_hm_info check"),
361+
(AbstractInnerType::Interface(..), AbstractInnerType::Interface(..))
362+
| (AbstractInnerType::LocalInterface(_), AbstractInnerType::LocalInterface(_)) => {
363+
// No nested unification, I'm actually thinking we should get rid of interfaces as types...
364+
// TODO: Is this okay?
365+
UnifyResult::Success
366+
}
367+
(a, b) => unreachable!(
368+
"All others should have been eliminated by get_hm_info check, but found {a:?}, {b:?}"
369+
),
362370
}
363371
}
364372

0 commit comments

Comments
 (0)