Commit a47db393 authored by Martin Wierich's avatar Martin Wierich
Browse files

- check.icl: solved check-bug-11:

    Check Error [case_bug.icl,18,f]:"_" illegal combination of patterns
    f t = case t of {(a,2) -> 1;	_ | False -> 2;	(a,b) -> 3;};
- typesupport.icl: small typo
- trans.icl: small optimisation
parent 9a007500
This diff is collapsed.
......@@ -459,7 +459,7 @@ cIsALocalVar :== False
| AP_Basic !BasicValue OptionalVariable
| AP_Dynamic !AuxiliaryPattern !DynamicType !OptionalVariable
| AP_Constant !AP_Kind !(Global DefinedSymbol) !Priority
| AP_WildCard OptionalVariable
| AP_WildCard !VarInfoPtr !OptionalVariable
| AP_Empty !Ident
:: AP_Kind = APK_Constructor !Index | APK_Macro
......
......@@ -415,7 +415,7 @@ cIsALocalVar :== False
| AP_Basic !BasicValue OptionalVariable
| AP_Dynamic !AuxiliaryPattern !DynamicType !OptionalVariable
| AP_Constant !AP_Kind !(Global DefinedSymbol) !Priority
| AP_WildCard OptionalVariable
| AP_WildCard !VarInfoPtr !OptionalVariable
| AP_Empty !Ident
:: AP_Kind = APK_Constructor !Index | APK_Macro
......@@ -1295,7 +1295,7 @@ where
instance <<< CasePatterns
where
(<<<) file (BasicPatterns type patterns) = file <<< patterns
(<<<) file (BasicPatterns type patterns) = file <<< " " <<<patterns
(<<<) file (AlgebraicPatterns type patterns) = file <<< patterns
(<<<) file (DynamicPatterns patterns) = file <<< patterns
(<<<) file NoPattern = file
......@@ -1668,7 +1668,7 @@ where
instance <<< OptGuardedAlts
where
(<<<) file (GuardedAlts guarded_exprs def_expr) = file <<<guarded_exprs <<< def_expr
(<<<) file (GuardedAlts guarded_exprs def_expr) = file <<< guarded_exprs <<< def_expr
(<<<) file (UnGuardedExpr unguarded_expr) = file <<< unguarded_expr
instance <<< ExprWithLocalDefs
......
......@@ -1064,6 +1064,8 @@ removeNeverMatchingSubcases keesExpr=:(Case kees)
filtered_default = get_filtered_default case_default
= case case_guards of
AlgebraicPatterns i alg_patterns
| not (any (is_never_matching_case o get_alg_rhs) alg_patterns)
-> keesExpr // frequent case: all subexpressions can't fail
# filtered_case_guards = filter (not o is_never_matching_case o get_alg_rhs) alg_patterns
| has_become_never_matching filtered_default filtered_case_guards
-> Case neverMatchingCase
......@@ -1071,6 +1073,8 @@ removeNeverMatchingSubcases keesExpr=:(Case kees)
-> fromYes case_default
-> Case {kees & case_guards = AlgebraicPatterns i filtered_case_guards, case_default = filtered_default }
BasicPatterns bt basic_patterns
| not (any (is_never_matching_case o get_basic_rhs) basic_patterns)
-> keesExpr // frequent case: all subexpressions can't fail
# filtered_case_guards = filter (not o is_never_matching_case o get_basic_rhs) basic_patterns
| has_become_never_matching filtered_default filtered_case_guards
-> Case neverMatchingCase
......
......@@ -147,7 +147,7 @@ where
# (ok, types, env) = cleanUpClosed types env
= (ok, TA tc types, env)
cleanUpClosed (argtype --> restype) env
# (ok, (argtype,res_type), env) = cleanUpClosed (argtype,restype) env
# (ok, (argtype,restype), env) = cleanUpClosed (argtype,restype) env
= (ok, argtype --> restype, env)
cleanUpClosed (TempCV tv_number :@: types) env
#! type = env.[tv_number]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment