-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement :require [WIP] #22343
base: main
Are you sure you want to change the base?
Implement :require [WIP] #22343
Conversation
} | ||
} | ||
|
||
// TODO: no idea how to access and reload the class paths |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is pretty tricky. There is a method updateClassPath but it's not used anywhere and I'm pretty sure it never worked and was just copy-pasted from Scala 2.
ctx.platform.classPath is used from ctx.platform.rootLoader which is itself used to setup RootClass
which corresponds to __root__
from which all imports start. But RootClass
is a symbol created once when we initialize the initial context and never again, so updateClassPath
won't actually help us import any new symbol
So I think we need to recreate a rootCtx, which is akin to what :settings seems to do:
scala3/compiler/src/dotty/tools/repl/ReplDriver.scala
Lines 542 to 543 in 5176f9f
rootCtx = setupRootCtx(tokenize(arg).toArray, rootCtx) | |
state.copy(context = rootCtx) |
#21658