aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/host.old.lux
diff options
context:
space:
mode:
authorEduardo Julian2021-01-12 17:31:48 -0400
committerEduardo Julian2021-01-12 17:31:48 -0400
commit5dbf134346424602b0104d1f749c1a9eac6f21af (patch)
treeac77441b9fcbc66a6f9ef1e5a55ccf0b1bcc996e /stdlib/source/lux/host.old.lux
parent8aac0c573c29d2829242d66539a9e027d03ff8ec (diff)
Compiler now shows suggestions when encountering unknown definitions.
Diffstat (limited to '')
-rw-r--r--stdlib/source/lux/host.old.lux24
1 files changed, 14 insertions, 10 deletions
diff --git a/stdlib/source/lux/host.old.lux b/stdlib/source/lux/host.old.lux
index 0d95d6e9e..2fc846e18 100644
--- a/stdlib/source/lux/host.old.lux
+++ b/stdlib/source/lux/host.old.lux
@@ -1634,25 +1634,29 @@
[=args (member_def_arg_bindings type_params class member)]
(member_def_interop type_params kind class =args member method_prefix import_format))))
-(def: (interface? class)
- (All [a] (-> (primitive "java.lang.Class" [a]) Bit))
- ("jvm invokevirtual:java.lang.Class:isInterface:" class))
+(type: (java/lang/Class a)
+ (primitive "java.lang.Class" [a]))
+
+(def: interface?
+ (All [a] (-> (java/lang/Class a) Bit))
+ (|>> "jvm invokevirtual:java.lang.Class:isInterface:"))
(def: (load_class class_name)
- (-> Text (Try (primitive "java.lang.Class" [Any])))
- (try ("jvm invokestatic:java.lang.Class:forName:java.lang.String" class_name)))
+ (-> Text (Try (java/lang/Class Any)))
+ (..try ("jvm invokestatic:java.lang.Class:forName:java.lang.String" class_name)))
(def: (class_kind [class_name _])
(-> Class_Declaration (Meta Class_Kind))
- (let [class_name (sanitize class_name)]
- (case (load_class class_name)
- (#.Right class)
+ (let [class_name (..sanitize class_name)]
+ (case (..load_class class_name)
+ (#try.Success class)
(\ meta.monad wrap (if (interface? class)
#Interface
#Class))
- (#.Left _)
- (meta.fail (format "Unknown class: " class_name)))))
+ (#try.Failure error)
+ (meta.fail (format "Cannot load class: " class_name text.new_line
+ error)))))
(syntax: #export (import:
{class_decl ..class_decl^}