Tritlo / PropR

Genetic program repair using GHC
MIT License
30 stars 2 forks source link

Fix out-of-scope expression fits and amibguously typed fits #83

Closed Tritlo closed 3 years ago

Tritlo commented 3 years ago

It fixes the scope issue, but it reveals another issue: we're not solving all the relevantConstraints for some fits, i.e.

example :: [[Maybe Int]]
example =
  [[n], [j 1]]
  where
    n = Nothing
    j = Just

allBlankEx :: [[Maybe Int]]
allBlankEx = [[Nothing | n <- [0]] | g <- [0]]

propIsAllBlank :: Bool
propIsAllBlank = example == allBlankEx

will now complain with:

temp_dir/4159bf8d/tests/cases/ExprWhere/checks/1bba7bf8/FakeCheckTarget1bba7bf8.hs:450:39: error:
    * No instance for (Num [Maybe Int]) arising from the literal `0'
    * In the expression: 0
      In the expression: [0]
      In a stmt of a list comprehension: g <- [0]
    |
450 |               allBlankEx = [g | g <- [0]]
    |                                       ^

temp_dir/4159bf8d/tests/cases/ExprWhere/checks/1bba7bf8/FakeCheckTarget1bba7bf8.hs:462:39: error:
    * No instance for (Num [Maybe Int]) arising from the literal `0'
    * In the expression: 0
      In the expression: [0]
      In a stmt of a list comprehension: g <- [0]
    |
462 |               allBlankEx = [g | g <- [0]]
    |                                       ^

temp_dir/4159bf8d/tests/cases/ExprWhere/checks/1bba7bf8/FakeCheckTarget1bba7bf8.hs:549:52: error:
    * No instance for (Num (Maybe Int)) arising from the literal `0'
    * In the expression: 0
      In the expression: [0]
      In a stmt of a list comprehension: g <- [0]
    |
549 |               allBlankEx = [[g | n <- [0]] | g <- [0]]
    |                                                    ^

temp_dir/4159bf8d/tests/cases/ExprWhere/checks/1bba7bf8/FakeCheckTarget1bba7bf8.hs:561:52: error:
    * No instance for (Num (Maybe Int)) arising from the literal `0'
    * In the expression: 0
      In the expression: [0]
      In a stmt of a list comprehension: g <- [0]
    |
561 |               allBlankEx = [[g | n <- [0]] | g <- [0]]
    |                                                    ^

temp_dir/4159bf8d/tests/cases/ExprWhere/checks/1bba7bf8/FakeCheckTarget1bba7bf8.hs:582:40: error:
    * No instance for (Num (Maybe Int)) arising from the literal `0'
    * In the expression: 0
      In the expression: [0]
      In a stmt of a list comprehension: n <- [0]
    |
582 |               allBlankEx = [[n | n <- [0]] | g <- [0]]
    |                                        ^

temp_dir/4159bf8d/tests/cases/ExprWhere/checks/1bba7bf8/FakeCheckTarget1bba7bf8.hs:594:40: error:
    * No instance for (Num (Maybe Int)) arising from the literal `0'
    * In the expression: 0
      In the expression: [0]
      In a stmt of a list comprehension: n <- [0]
    |
594 |               allBlankEx = [[n | n <- [0]] | g <- [0]]
    |                                        ^

temp_dir/4159bf8d/tests/cases/ExprWhere/checks/1bba7bf8/FakeCheckTarget1bba7bf8.hs:714:56: error:
    * No instance for (Num [t1]) arising from the literal `0'
    * In the expression: 0
      In the expression: [0]
      In a stmt of a list comprehension: g <- [0]
    |
714 |               allBlankEx = [[Nothing | n <- g] | g <- [0]]
    |                                                        ^

temp_dir/4159bf8d/tests/cases/ExprWhere/checks/1bba7bf8/FakeCheckTarget1bba7bf8.hs:726:56: error:
    * No instance for (Num [t0]) arising from the literal `0'
    * In the expression: 0
      In the expression: [0]
      In a stmt of a list comprehension: g <- [0]
    |
726 |               allBlankEx = [[Nothing | n <- g] | g <- [0]]
    |                                                        ^

temp_dir/4159bf8d/tests/cases/ExprWhere/checks/1bba7bf8/FakeCheckTarget1bba7bf8.hs:1737:64: error:
    * No instance for (Num ([Maybe a1] -> [Maybe Int]))
        arising from the literal `0'
        (maybe you haven't applied a function to enough arguments?)
    * In the expression: 0
      In the expression: [0]
      In a stmt of a list comprehension: g <- [0]
     |
1737 |               allBlankEx = [(g ([Nothing | n <- [0]])) | g <- [0]]
     |                                                                ^

temp_dir/4159bf8d/tests/cases/ExprWhere/checks/1bba7bf8/FakeCheckTarget1bba7bf8.hs:1749:64: error:
    * No instance for (Num ([Maybe a0] -> [Maybe Int]))
        arising from the literal `0'
        (maybe you haven't applied a function to enough arguments?)
    * In the expression: 0
      In the expression: [0]
      In a stmt of a list comprehension: g <- [0]
     |
1749 |               allBlankEx = [(g ([Nothing | n <- [0]])) | g <- [0]]
     |                                                                ^

temp_dir/4159bf8d/tests/cases/ExprWhere/checks/1bba7bf8/FakeCheckTarget1bba7bf8.hs:1935:64: error:
    * No instance for (Num (Maybe a3 -> Maybe Int))
        arising from the literal `0'
        (maybe you haven't applied a function to enough arguments?)
    * In the expression: 0
      In the expression: [0]
      In a stmt of a list comprehension: g <- [0]
     |
1935 |               allBlankEx = [[(g (Nothing)) | n <- [0]] | g <- [0]]
     |                                                                ^

temp_dir/4159bf8d/tests/cases/ExprWhere/checks/1bba7bf8/FakeCheckTarget1bba7bf8.hs:1947:64: error:
    * No instance for (Num (Maybe a2 -> Maybe Int))
        arising from the literal `0'
        (maybe you haven't applied a function to enough arguments?)
    * In the expression: 0
      In the expression: [0]
      In a stmt of a list comprehension: g <- [0]
     |
1947 |               allBlankEx = [[(g (Nothing)) | n <- [0]] | g <- [0]]
     |                                                                ^

temp_dir/4159bf8d/tests/cases/ExprWhere/checks/1bba7bf8/FakeCheckTarget1bba7bf8.hs:2067:52: error:
    * No instance for (Num (Maybe a5 -> Maybe Int))
        arising from the literal `0'
        (maybe you haven't applied a function to enough arguments?)
    * In the expression: 0
      In the expression: [0]
      In a stmt of a list comprehension: n <- [0]
     |
2067 |               allBlankEx = [[(n (Nothing)) | n <- [0]] | g <- [0]]
     |                                                    ^

temp_dir/4159bf8d/tests/cases/ExprWhere/checks/1bba7bf8/FakeCheckTarget1bba7bf8.hs:2079:52: error:
    * No instance for (Num (Maybe a4 -> Maybe Int))
        arising from the literal `0'
        (maybe you haven't applied a function to enough arguments?)
    * In the expression: 0
      In the expression: [0]
      In a stmt of a list comprehension: n <- [0]
     |
2079 |               allBlankEx = [[(n (Nothing)) | n <- [0]] | g <- [0]]
Tritlo commented 3 years ago

This follow-up issue is tracked in #83