Skip to content

Commit

Permalink
Merge pull request #3293 from mtzguido/3292
Browse files Browse the repository at this point in the history
Partial fix for 3292
  • Loading branch information
mtzguido committed May 17, 2024
2 parents 15b6124 + bd66193 commit 865efb6
Show file tree
Hide file tree
Showing 6 changed files with 188 additions and 9 deletions.
12 changes: 8 additions & 4 deletions ocaml/fstar-lib/generated/FStar_Parser_AST.ml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions src/parser/FStar.Parser.AST.fst
Original file line number Diff line number Diff line change
Expand Up @@ -328,15 +328,15 @@ let string_to_op s =
match s with
| "Amp" -> Some ("&", None)
| "At" -> Some ("@", None)
| "Plus" -> Some ("+", None)
| "Plus" -> Some ("+", Some 2)
| "Minus" -> Some ("-", None)
| "Subtraction" -> Some ("-", Some 2)
| "Tilde" -> Some ("~", None)
| "Slash" -> Some ("/", None)
| "Slash" -> Some ("/", Some 2)
| "Backslash" -> Some ("\\", None)
| "Less" -> Some ("<", None)
| "Less" -> Some ("<", Some 2)
| "Equals" -> Some ("=", None)
| "Greater" -> Some (">", None)
| "Greater" -> Some (">", Some 2)
| "Underscore" -> Some ("_", None)
| "Bar" -> Some ("|", None)
| "Bang" -> Some ("!", None)
Expand Down
2 changes: 1 addition & 1 deletion src/parser/FStar.Parser.AST.fsti
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ val strip_prefix : string -> string -> option string

val compile_op : int -> string -> range -> string
val compile_op' : string -> range -> string
val string_to_op : string -> option (string & option int)
val string_to_op : string -> option (string & option int) // returns operator symbol and optional arity

val string_of_fsdoc : string & list (string & string) -> string
val string_of_let_qualifier : let_qualifier -> string
Expand Down
19 changes: 19 additions & 0 deletions tests/error-messages/Bug3292.fst
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module Bug3292

#set-options "--print_implicits"

let op_Plus #a (x y : a) = (x,y)
let op_Minus #a (x y : a) = (x,y)
let op_Slash #a (x y : a) = (x,y)
let op_Greater #a (x y : a) = (x,y)
let op_Less #a (x y : a) = (x,y)
let op_GreaterEquals #a (x y : a) = (x,y)
let op_LessEquals #a (x y : a) = (x,y)

let _ = 1 + 1
let _ = 1 - 1
let _ = 1 / 1
let _ = 1 > 1
let _ = 1 < 1
let _ = 1 >= 1
let _ = 1 <= 1
155 changes: 155 additions & 0 deletions tests/error-messages/Bug3292.fst.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
Module after desugaring:
module Bug3292
Declarations: [
#set-options "--print_implicits"
let op_Plus #a x y = x, y
let op_Minus #a x y = x, y
let op_Slash #a x y = x, y
let op_Greater #a x y = x, y
let op_Less #a x y = x, y
let op_GreaterEquals #a x y = x, y
let op_LessEquals #a x y = x, y
private
let _ = 1 + 1
private
let _ = 1 - 1
private
let _ = 1 / 1
private
let _ = 1 > 1
private
let _ = 1 < 1
private
let _ = 1 >= 1
private
let _ = 1 <= 1
]
Exports: [
#set-options "--print_implicits"
let op_Plus #a x y = x, y
let op_Minus #a x y = x, y
let op_Slash #a x y = x, y
let op_Greater #a x y = x, y
let op_Less #a x y = x, y
let op_GreaterEquals #a x y = x, y
let op_LessEquals #a x y = x, y
private
let _ = 1 + 1
private
let _ = 1 - 1
private
let _ = 1 / 1
private
let _ = 1 > 1
private
let _ = 1 < 1
private
let _ = 1 >= 1
private
let _ = 1 <= 1
]

Module before type checking:
module Bug3292
Declarations: [
#set-options "--print_implicits"
let op_Plus x y = x, y
let op_Minus x y = x, y
let op_Slash x y = x, y
let op_Greater x y = x, y
let op_Less x y = x, y
let op_GreaterEquals x y = x, y
let op_LessEquals x y = x, y
private
let _ = 1 + 1
private
let _ = 1 - 1
private
let _ = 1 / 1
private
let _ = 1 > 1
private
let _ = 1 < 1
private
let _ = 1 >= 1
private
let _ = 1 <= 1
]
Exports: [
#set-options "--print_implicits"
let op_Plus x y = x, y
let op_Minus x y = x, y
let op_Slash x y = x, y
let op_Greater x y = x, y
let op_Less x y = x, y
let op_GreaterEquals x y = x, y
let op_LessEquals x y = x, y
private
let _ = 1 + 1
private
let _ = 1 - 1
private
let _ = 1 / 1
private
let _ = 1 > 1
private
let _ = 1 < 1
private
let _ = 1 >= 1
private
let _ = 1 <= 1
]

Module after type checking:
module Bug3292
Declarations: [
#set-options "--print_implicits"
let op_Plus #a x y = FStar.Pervasives.Native.Mktuple2 #a #a x y
let op_Minus #a x y = FStar.Pervasives.Native.Mktuple2 #a #a x y
let op_Slash #a x y = FStar.Pervasives.Native.Mktuple2 #a #a x y
let op_Greater #a x y = FStar.Pervasives.Native.Mktuple2 #a #a x y
let op_Less #a x y = FStar.Pervasives.Native.Mktuple2 #a #a x y
let op_GreaterEquals #a x y = FStar.Pervasives.Native.Mktuple2 #a #a x y
let op_LessEquals #a x y = FStar.Pervasives.Native.Mktuple2 #a #a x y
private
let _ = Bug3292.op_Plus #Prims.int 1 1
private
let _ = 1 - 1
private
let _ = Bug3292.op_Slash #Prims.int 1 1
private
let _ = Bug3292.op_Greater #Prims.int 1 1
private
let _ = Bug3292.op_Less #Prims.int 1 1
private
let _ = 1 >= 1
private
let _ = 1 <= 1
]
Exports: [
#set-options "--print_implicits"
let op_Plus #a x y = FStar.Pervasives.Native.Mktuple2 #a #a x y
let op_Minus #a x y = FStar.Pervasives.Native.Mktuple2 #a #a x y
let op_Slash #a x y = FStar.Pervasives.Native.Mktuple2 #a #a x y
let op_Greater #a x y = FStar.Pervasives.Native.Mktuple2 #a #a x y
let op_Less #a x y = FStar.Pervasives.Native.Mktuple2 #a #a x y
let op_GreaterEquals #a x y = FStar.Pervasives.Native.Mktuple2 #a #a x y
let op_LessEquals #a x y = FStar.Pervasives.Native.Mktuple2 #a #a x y
private
let _ = Bug3292.op_Plus #Prims.int 1 1
private
let _ = 1 - 1
private
let _ = Bug3292.op_Slash #Prims.int 1 1
private
let _ = Bug3292.op_Greater #Prims.int 1 1
private
let _ = Bug3292.op_Less #Prims.int 1 1
private
let _ = 1 >= 1
private
let _ = 1 <= 1
]

Verified module: Bug3292
All verification conditions discharged successfully
1 change: 1 addition & 0 deletions tests/error-messages/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ all: check-all
Bug1997.fst.output: OTHERFLAGS+=--dump_module Bug1997
Bug2820.fst.output: OTHERFLAGS+=--dump_module Bug2820
Bug3227.fst.output: OTHERFLAGS+=--dump_module Bug3227
Bug3292.fst.output: OTHERFLAGS+=--dump_module Bug3292
CalcImpl.fst.output: OTHERFLAGS+=--dump_module CalcImpl

include $(FSTAR_HOME)/examples/Makefile.common
Expand Down

0 comments on commit 865efb6

Please sign in to comment.